What I’m trying to do:
Hi,
I have some server code that makes http POST requests to an API. I am on the free plan so cannot use requests and so am using anvil.http.request
My http request is working ok but I cannot work out how to read the http status code returned by the API (200 if successful). I have read the documentation and the only thing I can find that is related to this is the anvil.http.HttpError command.
Is there any way of just seeing the http status code rather than just error codes?
Below is the code that I am using to make the http POST request. This works fine but I want to be able to check the status code to see confirm it is successful before moving on to the next operation. This is very easy to do using requests when using normal Python.
Code Sample:
createRoomResponse = anvil.http.request(url='https://webexapis.com/v1/rooms',
method="POST",
data={'title': f'{displayName} Test Space'},
headers= {'Authorization': 'Bearer ' + webexaccesstoken,'Content-type': 'application/json;charset=utf-8'}
)