diff --git a/app/services/tcgplayer_api.py b/app/services/tcgplayer_api.py index 292b502..eda297e 100644 --- a/app/services/tcgplayer_api.py +++ b/app/services/tcgplayer_api.py @@ -55,7 +55,7 @@ class TCGPlayerAPIService: "from": 0, "size": size } - response = self.requests_util.send_request(url, method='POST', cookies=self.cookies, data=payload) + response = self.requests_util.send_request(url, method='POST', cookies=self.cookies, json=payload) if response: return response.json() return None diff --git a/app/services/util/_requests.py b/app/services/util/_requests.py index 9d95bba..a94cec9 100644 --- a/app/services/util/_requests.py +++ b/app/services/util/_requests.py @@ -119,7 +119,7 @@ class RequestsUtil: if time_diff < time_between_requests: time.sleep(time_between_requests - time_diff) - def send_request(self, url: str, method: str, cookies: dict, data=None) -> requests.Response: + def send_request(self, url: str, method: str, cookies: dict, data=None, json=None) -> requests.Response: """Send a request with the specified cookies""" headers = self.set_headers(url, method) @@ -128,7 +128,7 @@ class RequestsUtil: try: self.rate_limit() - response = requests.request(method, url, headers=headers, cookies=cookies, data=data) + response = requests.request(method, url, headers=headers, cookies=cookies, data=data, json=json) response.raise_for_status() self.previous_request_time = datetime.now()