Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dchristl committed Jan 20, 2024
1 parent b7b08d6 commit 61912b2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions endpoint/mh_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def do_POST(self):
headers=pypush_gsa_icloud.generate_anisette_headers(),
json=data)
logger.debug('Return from fetch service:')
logger.debug(r.content.decode())
result = json.loads(r.content.decode())
logger.debug(result)
results = result['results']

newResults = OrderedDict()
Expand All @@ -87,11 +87,13 @@ def do_POST(self):
# send the body of the response
responseBody = json.dumps(result)
self.wfile.write(responseBody.encode())

except requests.exceptions.ConnectTimeout:
logger.error("Timeout to " + config.getAnisetteServer() +
", is your anisette running and accepting Connections?")
self.send_response(504)
except Exception as e:
logger.error("Unknown error occured {e}", exc_info=True)
self.send_response(501)

def getCurrentTimes(self):
clientTime = datetime.utcnow().replace(microsecond=0).isoformat() + 'Z'
Expand Down Expand Up @@ -144,4 +146,4 @@ def getAuth(regenerate=False, second_factor='sms'):
pass
finally:
httpd.server_close()
logger.info('Server stopped')
logger.info('Server stopped')

0 comments on commit 61912b2

Please sign in to comment.