nailgun.client
¶
Wrappers for methods in the Requests module.
The functions in this module wrap functions from the Requests module. Each function is modified with the following behaviours:
- It sets the ‘content-type’ header to ‘application/json’, so long as no content-type is already set.
- It encodes its
data
argument as JSON (using thejson
module) if the ‘content-type’ header is ‘application/json’. - It logs information about the request before it is sent.
- It logs information about the response when it is received.
-
nailgun.client.
delete
(url, **kwargs)¶ A wrapper for
requests.delete
. Sends a DELETE request.
-
nailgun.client.
get
(url, params=None, **kwargs)¶ A wrapper for
requests.get
.
-
nailgun.client.
head
(url, **kwargs)¶ A wrapper for
requests.head
.
-
nailgun.client.
patch
(url, data=None, **kwargs)¶ A wrapper for
requests.patch
. Sends a PATCH request.
-
nailgun.client.
post
(url, data=None, json=None, **kwargs)¶ A wrapper for
requests.post
.
-
nailgun.client.
put
(url, data=None, **kwargs)¶ A wrapper for
requests.put
. Sends a PUT request.
-
nailgun.client.
request
(method, url, **kwargs)¶ A wrapper for
requests.request
.