Fix Base.parameters. Now they will refresh after making a requests

This commit is contained in:
Alex Lushpai 2021-03-18 15:57:50 +03:00 committed by GitHub
commit 27ff0849ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ class Base(object):
requests_url = base_url + url if not self.parameters else base_url + url + "?" + query_builder(self.parameters) requests_url = base_url + url if not self.parameters else base_url + url + "?" + query_builder(self.parameters)
response = requests.get(requests_url, headers={ response = requests.get(requests_url, headers={
'X-API-KEY': self.api_key}) 'X-API-KEY': self.api_key})
self.parameters = {}
return Response(response.status_code, response.json()) return Response(response.status_code, response.json())
@ -42,7 +43,8 @@ class Base(object):
requests_url = base_url + url requests_url = base_url + url
response = requests.post(requests_url, data=self.parameters, headers={ response = requests.post(requests_url, data=self.parameters, headers={
'X-API-KEY': self.api_key}) 'X-API-KEY': self.api_key})
self.parameters = {}
return Response(response.status_code, response.json()) return Response(response.status_code, response.json())
def api_versions(self): def api_versions(self):