init commit
This commit is contained in:
24
itd/request.py
Normal file
24
itd/request.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from requests import Session
|
||||
|
||||
s = Session()
|
||||
|
||||
|
||||
def fetch(token: str, method: str, url: str):
|
||||
res = eval(f's.{method}')(f'https://итд.com/api/{url}', headers={
|
||||
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
||||
"Accept-Language": "ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3",
|
||||
"Accept-Encoding": "gzip, deflate, br, zstd",
|
||||
"Authorization": 'Bearer ' + token,
|
||||
"Sec-GPC": "1",
|
||||
"Upgrade-Insecure-Requests": "1",
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Priority": "u=0, i",
|
||||
"Pragma": "no-cache",
|
||||
"Cache-Control": "no-cache",
|
||||
"TE": "trailers"
|
||||
})
|
||||
res.raise_for_status()
|
||||
return res.json()
|
||||
Reference in New Issue
Block a user