Skip to content

Commit

Permalink
follow redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
JR-1991 committed Apr 18, 2024
1 parent 3e8c53a commit 06d2d6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pyDataverse/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def get_request(self, url, params=None, auth=False):

try:
url = urljoin(self.base_url_api, url)
resp = httpx.get(url, params=params)
resp = httpx.get(url, params=params, follow_redirects=True)
if resp.status_code == 401:
error_msg = resp.json()["message"]
raise ApiAuthorizationError(
Expand Down Expand Up @@ -175,7 +175,7 @@ def post_request(self, url, data=None, auth=False, params=None, files=None):
params["key"] = self.api_token

try:
resp = httpx.post(url, data=data, params=params, files=files)
resp = httpx.post(url, data=data, params=params, files=files, follow_redirects=True)
if resp.status_code == 401:
error_msg = resp.json()["message"]
raise ApiAuthorizationError(
Expand Down Expand Up @@ -216,7 +216,7 @@ def put_request(self, url, data=None, auth=False, params=None):
params["key"] = self.api_token

try:
resp = httpx.put(url, data=data, params=params)
resp = httpx.put(url, data=data, params=params, follow_redirects=True)
if resp.status_code == 401:
error_msg = resp.json()["message"]
raise ApiAuthorizationError(
Expand Down Expand Up @@ -255,7 +255,7 @@ def delete_request(self, url, auth=False, params=None):
params["key"] = self.api_token

try:
return httpx.delete(url, params=params)
return httpx.delete(url, params=params, follow_redirects=True)
except ConnectError:
raise ConnectError(
"ERROR: DELETE could not establish connection to api {}.".format(url)
Expand Down

0 comments on commit 06d2d6b

Please sign in to comment.