Http
HTTP¶
class HTTP¶
HTTP(timeout=5000, ctx=())
ctx sequence. The timeout, in milliseconds, is used for connections timeout. The ctx sequence is composed as in the following:
cacert: a bytearray for the Certification Authority certificate.clicert: a bytearray for the client certificate.clikey: a bytearray for the client private key.verify: aBoolthat specifies whether the client has to be verified be the server or not.global: aBoolthat specifies whether the global context has to be used or not.sec: aBoolthat specifies whether to use hardware secure element or not.
method get¶
get(url, headers={})
url with the optional header dictionary. Returns a Response object with the server reply.
method post¶
post(url, headers={}, body="")
url with the optional header dictionary and the body string containing the POST data. Returns a Response object with the server reply.
method put¶
put(url, headers={}, body="")
url with the optional header dictionary and the body string containing the PUT data. Returns a Response object with the server reply.
method patch¶
patch(url, headers={}, body="")
url with the optional header dictionary and the body string containing the PATCH data. Returns a Response object with the server reply. method delete¶
delete(url, headers={}, body="")
url with the optional header dictionary and the body string containing the DELETE data. Returns a Response object with the server reply. method head¶
head(url, headers={})
url with the optional header dictionary. Returns a Response object with the server reply.
method download¶
download(url, fd, headers={})
url with the optional header dictionary and save the returning stream to fd file descriptor. If -1 is passed as fd the stream data is returned into the Response object. Returns a Response object with the server reply.
method destroy¶
destroy()
class Response¶
Response(status, data, headers)
statusis the HTTP return status from the server, as integer.datastream data when available, as bytearrayheadersis the set of HTTP headers associated to the request, as dictionary.