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): def __init__(self, version: str, cookie: str):
self.version = version self.version = version
self.headers = { self.headers = {
'accept': 'application/json, text/javascript, */*; q=0.01', "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', "accept-language": "it-IT,it;q=0.9,en-US;q=0.8,en;q=0.7",
'content-type': 'application/json; charset=UTF-8', "content-type": "application/json; charset=UTF-8",
'cookie': cookie, "cookie": cookie,
'origin': 'https://intel.ingress.com', "origin": "https://intel.ingress.com",
'priority': 'u=1, i', "priority": "u=1, i",
'referer': 'https://intel.ingress.com/', "referer": "https://intel.ingress.com/",
'sec-ch-ua': '"Chromium";v="142", "Google Chrome";v="142", "Not_A Brand";v="99"', "sec-ch-ua": '"Chromium";v="142", "Google Chrome";v="142", "Not_A Brand";v="99"',
'sec-ch-ua-mobile': '?0', "sec-ch-ua-mobile": "?0",
'sec-ch-ua-platform': '"macOS"', "sec-ch-ua-platform": '"macOS"',
'sec-fetch-dest': 'empty', "sec-fetch-dest": "empty",
'sec-fetch-mode': 'cors', "sec-fetch-mode": "cors",
'sec-fetch-site': 'same-origin', "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', "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', "x-requested-with": "XMLHttpRequest",
} }
# Extract CSRF token from cookie and add to headers # Extract CSRF token from cookie and add to headers
for item in cookie.split(';'): for item in cookie.split(";"):
if 'csrftoken' in item: if "csrftoken" in item:
self.headers['x-csrftoken'] = item.split('=')[1].strip() self.headers["x-csrftoken"] = item.split("=")[1].strip()
break break
def get_plexts( def get_plexts(
@@ -58,7 +58,9 @@ class IngressAPI:
"v": self.version, "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() response.raise_for_status()
try: try: