I am currently working with Python requests to get data from an API. I'm trying to have a nested request within the request depending on the value received from one of the responses. So basically, I make a request and one of the fields returned is uid
. I want again to pop that value into another request and that value makes part of the url. eg. f"https://registry.nbnatlas.org/ws/dataResource/{uid}"
.
The only issue is that some responses have a null value for the uid
field and this throws an error when making the nested request.
What I am trying to do is to skip the second request if the uid
field is null
CodePudding user response:
You can just add if uid is not None:
before the second request