Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 1ea42d2

Browse files
committed
added proxies to jatosAPI.py
1 parent 2edba55 commit 1ea42d2

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

jatosAPI.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212

1313
def get_met():
1414

15+
proxies = {
16+
'http': 'http://proxy.divms.uiowa.edu:8888',
17+
'https': 'https://proxy.divms.uiowa.edu:8888',
18+
}
19+
1520

1621
url = 'https://jatos.psychology.uiowa.edu/jatos/api/v1/results/metadata'
1722
headers = {
@@ -23,7 +28,7 @@ def get_met():
2328
'studyIds': [954, 969, 992, 912, 925, 941]
2429
}
2530

26-
response = requests.post(url, headers=headers, json=data)
31+
response = requests.post(url, headers=headers, json=data, proxies=proxies)
2732

2833
# If you want to print the response
2934
print(response.status_code)
@@ -56,6 +61,12 @@ def get_met():
5661
return study_result_ids
5762

5863
def get_data(study_result_ids):
64+
65+
proxies = {
66+
'http': 'http://proxy.divms.uiowa.edu:8888',
67+
'https': 'https://proxy.divms.uiowa.edu:8888',
68+
}
69+
5970
headers = {
6071
'accept': 'application/octet-stream',
6172
'Authorization': 'Bearer jap_5ThOJ14yf7z1EPEUpAoZYMWoETZcmJk305719',
@@ -68,7 +79,7 @@ def get_data(study_result_ids):
6879
}
6980

7081
url = 'https://jatos.psychology.uiowa.edu/jatos/api/v1/results/data'
71-
response = requests.post(url, headers=headers, json=datas)
82+
response = requests.post(url, headers=headers, json=datas, proxies=proxies)
7283
# Debugging information
7384
print(f"Status Code: {response.status_code}")
7485

0 commit comments

Comments
 (0)