anvil.http
Module
Classes
HttpError
Create a new ‘HttpError’ object
Constructor
HttpError()
HttpError Attributes
content - anvil.Media instance
The content returned by the request (eg the body of a 404 response)
status - number
The numeric HTTP status error (eg 404 for “not found”).
Status will be 0 for errors that prevent the request completing at all (eg cross-origin policy in the browser).
UrlEncodingError
Create a new ‘UrlEncodingError’ object
Constructor
UrlEncodingError()
Functions
request(url, [method="GET"], [data=None], [json=False], [headers=None], [username=None], [password=None], [timeout=None])
Make an HTTP request to the specified URL.
If json=True, the response is parsed into Python objects (dicts/lists/etc), and ‘data’ is JSON-encoded before sending.
‘headers’ can be a dict of strings to set HTTP headers. If specified, ‘username’ and ‘password’ will be used to perform HTTP Basic authentication.
url_decode(string_to_encode)
URL-decode a string. Raises UrlEncodingError on failure.
url_encode(string_to_encode)
URL-encode a string