I have a python code where I am making a https request.
import urllib3
https = urllib3.PoolManager(cert_reqs=ssl.CERT_NONE)
Here is how I am making a call to an api
myResponse = https.request(method="GET", url=f"{myEndpoint}?acctId={accountID}&acctType={accountType}", headers=headers)
response = json.loads(myResponse.data.decode("UTF-8"))
I know that response does not contain response["Records"]
I want to have few more lines of code but will need to run those lines if response contains response["Records"]
The code below always runs because response["Records"] is not contained in the response
if((response["Records"] != None) and (len(response["Records"]) != 0)):
pass
How can I write the python code to check response and only run my other lines of code if response["Records"] exit in response?