Http Client¶
The Http
client is a class which can be instantiated to access web services
via Ajax. It is implemented as an Observable which allows anyone to
subscribe to it and perform operations on the results.
It is located inside anpylar.http
. For example:
my_http = anpylar.http.Http()
Class Constructor¶
`Http(url='', headers=None, fullresp=False)`
url
is the base url, which can be later extended when calling a method
headers
is a dict with the headers. It can later be extended by each method
fulresp
ifFalse
, the body of responses with status codes between200
and299
will be returnedIf
True
the complete response will be returned. It will only be a failure if there is actually a failure in the connection (the browser blocks it, the connection times out, …)
Methods¶
get(url='', headers=None, data=None)
Issue a
GET
method extending theurl
andheaders
and adding anydata
passedReturns: Observable
post(url='', headers=None, data=None)
Issue a
POST
method extending theurl
andheaders
and adding anydata
passedReturns: Observable
put(url='', headers=None, data=None)
Issue a
PUT
method extending theurl
andheaders
and adding anydata
passedReturns: Observable
delete(url='', headers=None, data=None)
Issue a
DELETE
method extending theurl
andheaders
and adding anydata
passedReturns: Observable