fix: Added headers to requests
parent
a18fe64a68
commit
b1122ac048
|
@ -30,8 +30,18 @@ def get_admin_for_software(software: str, domain: str):
|
|||
|
||||
def get_nodeinfo(domain):
|
||||
try:
|
||||
wellknown = requests.get(f"https://{domain}/.well-known/nodeinfo", timeout=2).json()
|
||||
nodeinfo = requests.get(wellknown['links'][0]['href'], timeout=2).json()
|
||||
headers = {
|
||||
"Sec-Fetch-Dest": "document",
|
||||
"Sec-Fetch-Mode": "navigate",
|
||||
"Sec-Fetch-Site": "none",
|
||||
"Sec-Fetch-User": "?1",
|
||||
"Sec-GPC": "1",
|
||||
"User-Agent": "Fediseer/0.5",
|
||||
}
|
||||
wellknown = requests.get(f"https://{domain}/.well-known/nodeinfo", headers=headers, timeout=4).json()
|
||||
headers["Sec-Fetch-Site"] = "cross-site"
|
||||
nodeinfo = requests.get(wellknown['links'][0]['href'], headers=headers, timeout=2).json()
|
||||
return nodeinfo
|
||||
except Exception as err:
|
||||
logger.debug(err)
|
||||
return None
|
Loading…
Reference in New Issue