update headers

This commit is contained in:
Matteo Rosati
2026-01-13 10:33:02 +01:00
parent 932c75ad80
commit 1e76403565

View File

@@ -9,27 +9,27 @@ class IngressAPI:
def __init__(self, version: str, cookie: str):
self.version = version
self.headers = {
'accept': 'application/json, text/javascript, */*; q=0.01',
'accept-language': 'it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7',
'content-type': 'application/json; charset=UTF-8',
'cookie': cookie,
'origin': 'https://intel.ingress.com',
'priority': 'u=1, i',
'referer': 'https://intel.ingress.com/',
'sec-ch-ua': '"Chromium";v="142", "Google Chrome";v="142", "Not_A Brand";v="99"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"macOS"',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'same-origin',
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36',
'x-requested-with': 'XMLHttpRequest',
"accept": "application/json, text/javascript, */*; q=0.01",
"accept-language": "it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7",
"content-type": "application/json; charset=UTF-8",
"cookie": cookie,
"origin": "https://intel.ingress.com",
"priority": "u=1, i",
"referer": "https://intel.ingress.com/",
"sec-ch-ua": '"Chromium";v="142", "Google Chrome";v="142", "Not_A Brand";v="99"',
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": '"macOS"',
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36",
"x-requested-with": "XMLHttpRequest",
}
# Extract CSRF token from cookie and add to headers
for item in cookie.split(';'):
if 'csrftoken' in item:
self.headers['x-csrftoken'] = item.split('=')[1].strip()
for item in cookie.split(";"):
if "csrftoken" in item:
self.headers["x-csrftoken"] = item.split("=")[1].strip()
break
def get_plexts(
@@ -58,7 +58,9 @@ class IngressAPI:
"v": self.version,
}
response = requests.post(f"{self.BASE_URL}/getPlexts", json=payload, headers=self.headers)
response = requests.post(
f"{self.BASE_URL}/getPlexts", json=payload, headers=self.headers
)
response.raise_for_status()
try: