From 0fb514b36c61ceb2c8b86881aad7a03e45f85888 Mon Sep 17 00:00:00 2001 From: zjgilliam Date: Mon, 16 Sep 2024 19:05:17 -0500 Subject: [PATCH] added proxies to jatosAPI.py --- jatosAPI copy.py => jatosAPI.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) rename jatosAPI copy.py => jatosAPI.py (94%) diff --git a/jatosAPI copy.py b/jatosAPI.py similarity index 94% rename from jatosAPI copy.py rename to jatosAPI.py index c4c4892..5d8056c 100644 --- a/jatosAPI copy.py +++ b/jatosAPI.py @@ -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 = { @@ -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) @@ -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', @@ -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}")