Skip to content

Commit

Permalink
Merge pull request #4 from soroushkavousi/main
Browse files Browse the repository at this point in the history
fix get api calls should use query parameters
  • Loading branch information
mojtabaakbari221b authored Jul 18, 2024
2 parents 43b5213 + d9fbf16 commit 2c79b1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions sms_ir/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
20 changes: 10 additions & 10 deletions sms_ir/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand All @@ -197,7 +197,7 @@ def report_archived(

return self.get(
url,
data,
params,
)

def report_latest_received(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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,
Expand All @@ -262,7 +262,7 @@ def report_archived_received(

return self.get(
url,
data,
params,
)

def get_credit(self) -> Response:
Expand Down

0 comments on commit 2c79b1c

Please sign in to comment.