Updated settings for VScode, updated focus_compliance, fixed req
This commit is contained in:
@@ -24,6 +24,7 @@ class Request:
|
||||
|
||||
def get(self, path: str, **add_params):
|
||||
full_url = f'{self.base_url}{path}'
|
||||
payload = None
|
||||
|
||||
if self._access_key:
|
||||
payload = {'key': self._access_key, 'inn': self.inn, 'ogrn': self.ogrn}
|
||||
@@ -35,9 +36,10 @@ class Request:
|
||||
try:
|
||||
response = requests.get(url=full_url, params=payload)
|
||||
|
||||
if response.headers['Content-Type'] == 'application/pdf':
|
||||
return response
|
||||
else:
|
||||
if response.headers['Content-Type'] == 'application/json' or \
|
||||
response.headers['Content-Type'] == 'application/json; charset=utf-8':
|
||||
return response.json()
|
||||
else:
|
||||
return response
|
||||
except RequestException as e:
|
||||
return f'Error: {e}'
|
||||
|
||||
Reference in New Issue
Block a user