"user-agent": config["useragent"]
}
-
def get_hash(domain: str) -> str:
return sha256(domain.encode("utf-8")).hexdigest()
-
def get_peers(domain: str) -> str:
try:
res = get(f"https://{domain}/api/v1/instance/peers", headers=headers, timeout=5)
return res.json()
except:
+ print("WARNING: Cannot fetch peers:", domain)
return None
peerlist = get_peers(domain)
+if (peerlist is None):
+ print("FATAL: CANNOT FETCH PEERS:", domain)
+ sys.exit(255)
+
def get_type(instdomain: str) -> str:
try:
res = get(f"https://{instdomain}/nodeinfo/2.1.json", headers=headers, timeout=5)
c = conn.cursor()
c.execute(
- "SELECT domain FROM instances WHERE 1"
+ "SELECT domain FROM instances WHERE 1"
)
for instance in peerlist:
print(instance)
try:
c.execute(
- "SELECT domain FROM instances WHERE domain = ?", (instance,)
+ "SELECT domain FROM instances WHERE domain = ?", (instance,)
)
if c.fetchone() == None:
c.execute(