mirror of
https://gitlab.com/bashrc2/epicyon
synced 2026-11-01 18:29:54 +00:00
Additional debug information on getJson
This commit is contained in:
1 parent
c2bc98d4de
commit
cdd0f91dfb
2 files changed
+18
-1
No files matched your search
@@ -478,7 +478,8 @@ def pgpPublicKeyUpload(baseDir: str, session,
|
||||
if debug:
|
||||
print('Getting actor for ' + handle)
|
||||
|
||||
actorJson, asHeader = getActorJson(handle, False, False, debug, True)
|
||||
actorJson, asHeader = \
|
||||
getActorJson(domain, handle, False, False, debug, True)
|
||||
if not actorJson:
|
||||
if debug:
|
||||
print('No actor returned for ' + handle)
|
||||
|
||||
+16
@@ -13,6 +13,7 @@ from utils import urlPermitted
|
||||
import json
|
||||
from socket import error as SocketError
|
||||
import errno
|
||||
from http.client import HTTPConnection
|
||||
|
||||
baseDirectory = None
|
||||
|
||||
@@ -104,9 +105,24 @@ def getJson(session, url: str, headers: {}, params: {}, debug: bool,
|
||||
if not quiet:
|
||||
print('WARN: getJson failed, no session specified for getJson')
|
||||
return None
|
||||
|
||||
if debug:
|
||||
HTTPConnection.debuglevel = 1
|
||||
|
||||
try:
|
||||
result = session.get(url, headers=sessionHeaders,
|
||||
params=sessionParams, timeout=timeoutSec)
|
||||
if result.status_code != 200:
|
||||
if result.status_code == 401:
|
||||
print('WARN: getJson Unauthorized url: ' + url)
|
||||
elif result.status_code == 403:
|
||||
print('WARN: getJson Forbidden url: ' + url)
|
||||
elif result.status_code == 404:
|
||||
print('WARN: getJson Not Found url: ' + url)
|
||||
elif result.status_code != 200:
|
||||
print('WARN: getJson url: ' + url +
|
||||
' failed with error code ' +
|
||||
str(result.status_code))
|
||||
return result.json()
|
||||
except requests.exceptions.RequestException as e:
|
||||
sessionHeaders2 = sessionHeaders.copy()
|
||||
|
||||
Reference in new issue
Block a user