-
Notifications
You must be signed in to change notification settings - Fork 1
/
DOWNLOADER.PY
59 lines (43 loc) · 1.57 KB
/
DOWNLOADER.PY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import requests
import requests
url = 'http://schizconnect.org/api/auth/sign_in'
headers = {'Content-Type': 'application/json'}
data = {'email': '[email protected]', 'password': '318962420'}
response = requests.post(url, headers=headers, json=data)
# Check the status code of the response
print(response.status_code)
# Print the headers of the response
print(dict(response.headers))
import requests
url ='http://schizconnect.org/downloadable_files/16028'
headers = {
'access-token': dict(response.headers)["access-token"],
'client': dict(response.headers)["client"],
'uid': dict(response.headers)["uid"]
}
response1 = requests.get(url, headers=headers)
# Check the status code of the response
print(response1.status_code)
# Print the headers of the response
print(response1.headers)
# Save the content of the response (the file) to a local file
with open('16028.7z', 'wb') as f:
f.write(response1.content)
# Print the content of the response (the JSON data)
print(response1.json())
url ='http://schizconnect.org/downloadable_files/16030'
headers = {
'access-token': dict(response.headers)["access-token"],
'client': dict(response.headers)["client"],
'uid': dict(response.headers)["uid"]
}
response2 = requests.get(url, headers=headers)
# Check the status code of the response
print(response2.status_code)
# Print the headers of the response
print(response2.headers)
# Save the content of the response (the file) to a local file
with open('16030.7z', 'wb') as f:
f.write(response2.content)
# Print the content of the response (the JSON data)
print(response2.json())