Updated settings for VScode, updated focus_compliance, fixed req

This commit is contained in:
2025-03-17 18:51:26 +03:00
parent 6fcb30c497
commit 0cc2e9d429
3 changed files with 86 additions and 5 deletions

View File

@@ -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}'