try:
# DEBUG: print("DEBUG: BEFORE res[]:", type(res))
- if isinstance(res, BaseException) or isinstance(res, json.JSONDecodeError):
+ if isinstance(res, BaseException) or isinstance(res, json.decoder.JSONDecodeError):
res = str(res)
# DEBUG: print("DEBUG: AFTER res[]:", type(res))
raise ValueError(f"Parameter 'domain' cannot be empty")
# DEBUG: print("DEBUG: BEFORE res[]:", type(res))
- if isinstance(res, BaseException) or isinstance(res, json.JSONDecodeError):
+ if isinstance(res, BaseException) or isinstance(res, json.decoder.JSONDecodeError):
res = f"{type}:str(res)"
# DEBUG: print("DEBUG: AFTER res[]:", type(res))
"sort" : "+pubAt",
"host" : None,
"limit": step
- }), {"Origin": domain})
+ }), {
+ "Origin": domain
+ })
else:
fetched = post_json_api(domain, "/api/federation/instances", json.dumps({
"sort" : "+pubAt",
"host" : None,
"limit" : step,
"offset": offset - 1
- }), {"Origin": domain})
+ }), {
+ "Origin": domain
+ })
# DEBUG: print(f"DEBUG: fetched()={len(fetched))}")
if len(fetched) == 0:
"host" : None,
"suspended": True,
"limit" : step
- }), {"Origin": domain})
+ }), {
+ "Origin": domain
+ })
else:
# DEBUG: print("DEBUG: Sending JSON API request to domain,step,offset:", domain, step, offset)
fetched = post_json_api(domain, "/api/federation/instances", json.dumps({
"suspended": True,
"limit" : step,
"offset" : offset - 1
- }), {"Origin": domain})
+ }), {
+ "Origin": domain
+ })
# DEBUG: print("DEBUG: fetched():", len(fetched))
if len(fetched) == 0:
"host" : None,
"blocked": True,
"limit" : step
- }), {"Origin": domain})
+ }), {
+ "Origin": domain
+ })
else:
# DEBUG: print("DEBUG: Sending JSON API request to domain,step,offset:", domain, step, offset)
fetched = post_json_api(domain,"/api/federation/instances", json.dumps({
"host" : None,
"blocked": True,
"limit" : step,
- "offset" : offset-1
- }), {"Origin": domain})
+ "offset" : offset - 1
+ }), {
+ "Origin": domain
+ })
# DEBUG: print("DEBUG: fetched():", len(fetched))
if len(fetched) == 0:
# DEBUG: print(f"DEBUG: response.text()={len(response.text)} is not empty, invoking response.json() ...")
try:
data = response.json()
- except json.JSONDecodeError:
+ except json.decoder.JSONDecodeError:
pass
# DEBUG: print(f"DEBUG: data[]={type(data)} - EXIT!")