diff --git a/sms_ir/mixins.py b/sms_ir/mixins.py index bb91e22..0614a48 100644 --- a/sms_ir/mixins.py +++ b/sms_ir/mixins.py @@ -49,13 +49,13 @@ def delete(self, url): self.logger.error(str(e)) return self.fake_response(e.request) - def get(self, url, data=None): + def get(self, url, params=None): try : self.logger.info("send request to %s", url) return requests.get( url, headers=self._headers, - json=data or {}, + params=params, ) except (ConnectTimeout, HTTPError, ReadTimeout, Timeout, ConnectionError) as e: self.logger.error(str(e)) diff --git a/sms_ir/services.py b/sms_ir/services.py index ee09a15..7940e9b 100644 --- a/sms_ir/services.py +++ b/sms_ir/services.py @@ -165,14 +165,14 @@ def report_today( url = f'{self.ENDPOINT}/v1/send/live/' - data = { + params = { 'pageSize' : page_size, 'pageNumber' : page_number, } return self.get( url, - data, + params, ) def report_archived( @@ -188,7 +188,7 @@ def report_archived( url = f'{self.ENDPOINT}/v1/send/archive/' - data = { + params = { 'fromDate': from_date, 'toDate' : to_date, 'pageSize' : page_size, @@ -197,7 +197,7 @@ def report_archived( return self.get( url, - data, + params, ) def report_latest_received( @@ -210,13 +210,13 @@ def report_latest_received( url = f'{self.ENDPOINT}/v1/receive/latest/' - data = { + params = { 'count': count, } return self.get( url, - data, + params, ) def report_today_received( @@ -230,14 +230,14 @@ def report_today_received( url = f'{self.ENDPOINT}/v1/receive/live/' - data = { + params = { 'pageSize': page_size, 'pageNumber': page_number, } return self.get( url, - data, + params, ) def report_archived_received( @@ -253,7 +253,7 @@ def report_archived_received( url = f'{self.ENDPOINT}/v1/receive/archive/' - data = { + params = { 'fromDate' : from_date, 'toDate' : to_date, 'pageSize' : page_size, @@ -262,7 +262,7 @@ def report_archived_received( return self.get( url, - data, + params, ) def get_credit(self) -> Response: