The http Module¶
The http module wraps the underlying raw HTTP request module (requests currently) to separate the job of exposing the API from the job of dealing with lower-level interfacing with the HTTP client in use today.
-
class
pyrabbit.http.
HTTPClient
(api_url, uname, passwd, timeout=5, scheme='http')[source]¶ A wrapper for requests. Abstracts away things like path building, return value parsing, etc., so the api module code stays clean and easy to read/use.
-
do_call
(path, method, body=None, headers=None)[source]¶ Send an HTTP request to the REST API.
Parameters: - path (string) – A URL
- method (string) – The HTTP method (GET, POST, etc.) to use in the request.
- body (string) – A string representing any data to be sent in the body of the HTTP request.
- headers (dictionary) – “{header-name: header-value}” dictionary.
-