Skip to content

Commit

Permalink
added proxies to jatosAPI.py
Browse files Browse the repository at this point in the history
  • Loading branch information
miloswrath committed Sep 17, 2024
1 parent 1add3f6 commit 0fb514b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions jatosAPI copy.py → jatosAPI.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@

def get_met():

proxies = {
'http': 'http://proxy.divms.uiowa.edu:8888',
'https': 'https://proxy.divms.uiowa.edu:8888',
}


url = 'https://jatos.psychology.uiowa.edu/jatos/api/v1/results/metadata'
headers = {
Expand All @@ -23,7 +28,7 @@ def get_met():
'studyIds': [980, 981, 982, 904, 979, 977]
}

response = requests.post(url, headers=headers, json=data)
response = requests.post(url, headers=headers, json=data, proxies=proxies)

# If you want to print the response
print(response.status_code)
Expand Down Expand Up @@ -56,6 +61,12 @@ def get_met():
return study_result_ids

def get_data(study_result_ids):

proxies = {
'http': 'http://proxy.divms.uiowa.edu:8888',
'https': 'https://proxy.divms.uiowa.edu:8888',
}

headers = {
'accept': 'application/octet-stream',
'Authorization': 'Bearer jap_5ThOJ14yf7z1EPEUpAoZYMWoETZcmJk305719',
Expand All @@ -68,7 +79,7 @@ def get_data(study_result_ids):
}

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

Expand Down

0 comments on commit 0fb514b

Please sign in to comment.