I would like to use polling2 to send requests and take an action when status requirements are valid and also would like to monitor and store the response codes from the target endpoint. It could be either written as a log file to troubleshoot. Log part I added recently but it does not work like this to see the what is response code or what this function actually doing.
Could u help me understand how can I implement the response code from the target URL? Thanks in advance
my current usage of a piece of code like this
continueToPoll = True
while continueToPoll:
try:
r = polling2.poll(lambda: requests.request("GET", Url, auth=(userName, password)),step=60,poll_forever=True,verify=False,log_error=logging.DEBUG)
except:
print("Connection refused by the server..")
weekNumber = datetime.datetime.today().weekday()
start = datetime.time(5, 0, 0)
end = datetime.time(18, 0, 0)
current = datetime.datetime.now().time()
if current>= start and current <= end:
if weekNumber < 5:
time.sleep(300)
else:
time.sleep(3600)
else:
time.sleep(3600)
continue
x = r.json()
r.close()
currentChangeStatus = x['fields']['status']['name']
if currentStatus == expectedStatus: continueToPoll = False
I would like to use polling2 to send requests and take an action when status requirements are valid and also would like to monitor and store the response codes from the target endpoint. It could be either written as a log file to troubleshoot. Log part I added recently but it does not work like this to see the what is response code or what this function actually doing. Could u help me understand how can I implement the response code from the target URL? Thanks in advance
my current usage of a piece of code like this