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 9979ffa commit 7d93548
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions 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': [950, 964, 987, 902, 923, 936]
}

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,13 @@ 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 +80,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 7d93548

Please sign in to comment.