stop getting aliased domains
This commit is contained in:
pare
739c8bfb74
commit
fa047b0593
S'han modificat 1 arxius amb 24 adicions i 9 eliminacions
15
getpeers.py
15
getpeers.py
|
@ -47,6 +47,20 @@ def get_peers(peer):
|
|||
|
||||
user_agent = {'User-agent': "fediverse's stats (fediverse@mastodont.cat)"}
|
||||
|
||||
domain_res = requests.get('https://' + peer + '/api/v1/instance', headers = user_agent, timeout=3)
|
||||
|
||||
domain_res_json = domain_res.json()
|
||||
|
||||
if domain_res.status_code == 200:
|
||||
|
||||
domain_uri = domain_res_json['uri'].replace('https://', '')
|
||||
|
||||
if domain_uri != peer:
|
||||
|
||||
print(f'{peer} is an aliased domain of {domain_uri}!')
|
||||
|
||||
else:
|
||||
|
||||
response = requests.get('https://' + peer + peers_api, headers = user_agent, timeout=3)
|
||||
|
||||
response_json = response.json()
|
||||
|
@ -64,6 +78,7 @@ def get_peers(peer):
|
|||
except:
|
||||
|
||||
pass
|
||||
|
||||
except:
|
||||
|
||||
pass
|
||||
|
|
Loading…
Referencia en una nova incidència