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:

  1. It sets the ‘content-type’ header to ‘application/json’, so long as no content-type is already set.
  2. It encodes its data argument as JSON (using the json module) if the ‘content-type’ header is ‘application/json’.
  3. It logs information about the request before it is sent.
  4. 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.