Skip to content

Commit

Permalink
fix(c): Let data have value instead of None
Browse files Browse the repository at this point in the history
Signed-off-by: Kwong Tung Nan <[email protected]>
  • Loading branch information
kwongtn committed Jun 3, 2024
1 parent 19e8f77 commit c5e7984
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions common/imgurpython_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,23 @@ def make_request(self, method, route, data=None, force_anon=False):
"3/%s" % route if "oauth2" not in route else route
)

print("Data is: ", data)
if data is None:
params = {}
else:
params = data
print("Params is: ", params)

if method in ("delete", "get"):
response = method_to_call(url, headers=header, params=data, data=data)
response = method_to_call(url, headers=header, params=params, data=data)
else:
response = method_to_call(url, headers=header, data=data)

if response.status_code == 403 and self.auth is not None:
self.auth.refresh()
header = self.prepare_headers()
if method in ("delete", "get"):
response = method_to_call(url, headers=header, params=data, data=data)
response = method_to_call(url, headers=header, params=params, data=data)
else:
response = method_to_call(url, headers=header, data=data)

Expand Down

0 comments on commit c5e7984

Please sign in to comment.