Rest Adapter
Internal Functions
These functions are meant for use in other parts of the module. You probably shouldn't be calling these manually.
If there's an endpoint method missing from the main ZiplineApi class, you should open an issue (or a pull request).
This module contains the RestAdapter class, which is used to make requests to the Zipline server.
Classes:
Name | Description |
---|---|
RestAdapter |
Constructor for RestAdapter |
RestAdapter
Constructor for RestAdapter
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config
|
ZiplineApiConfig
|
Configuration object for the ZiplineApi class |
ZiplineApiConfig
|
Raises:
Type | Description |
---|---|
ValueError
|
Raised when the keyword arguments passed to the class constructor conflict. |
Methods:
Name | Description |
---|---|
delete |
Make a DELETE request to the Zipline server. You should almost never have to use this directly. |
get |
Make a GET request to the Zipline server. You should almost never have to use this directly. |
patch |
Make a PATCH request to the Zipline server. You should almost never have to use this directly. |
post |
Make a POST request to the Zipline server. You should almost never have to use this directly. |
Source code in pyzipline/rest_adapter.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
_do(http_method, endpoint, headers=None, params=None, json=None, files=None, timeout=60)
Internal method to make a request to the Zipline server. You shouldn't use this directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
http_method
|
str
|
The HTTP method to use |
required |
endpoint
|
str
|
The endpoint to make the request to. |
required |
headers
|
dict
|
Python dictionary of headers to send with the request. |
None
|
params
|
dict
|
Python dictionary of query parameters to send with the request. |
None
|
json
|
dict
|
Python dictionary of JSON-serializable data to send with the request. |
None
|
files
|
dict
|
Python dictionary of files to send with the request. |
None
|
timeout
|
float
|
Number of seconds to wait for the request to complete. |
60
|
Returns:
Name | Type | Description |
---|---|---|
Result |
Result
|
A Result object containing the status code, message, and data from the request. |
Raises:
Type | Description |
---|---|
HTTPError
|
Raised when an HTTP request fails. |
PyZiplineError
|
Raised when an error occurs in the PyZipline library. |
Source code in pyzipline/rest_adapter.py
delete(endpoint, headers=None, params=None, json=None, timeout=60)
Make a DELETE request to the Zipline server. You should almost never have to use this directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to make the request to. |
required |
params
|
dict
|
Python dictionary of query parameters to send with the request. |
None
|
json
|
dict
|
Python dictionary of JSON-serializable data to send with the request. |
None
|
timeout
|
float
|
Number of seconds to wait for the request to complete. |
60
|
Returns:
Name | Type | Description |
---|---|---|
Result |
Result
|
A Result object containing the status code, message, and data from the request. |
Source code in pyzipline/rest_adapter.py
get(endpoint, headers=None, params=None, timeout=60)
Make a GET request to the Zipline server. You should almost never have to use this directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to make the request to. |
required |
params
|
dict
|
Python dictionary of query parameters to send with the request. |
None
|
timeout
|
float
|
Number of seconds to wait for the request to complete. |
60
|
Returns:
Name | Type | Description |
---|---|---|
Result |
Result
|
A Result object containing the status code, message, and data from the request. |
Source code in pyzipline/rest_adapter.py
patch(endpoint, headers=None, params=None, json=None, files=None, timeout=60)
Make a PATCH request to the Zipline server. You should almost never have to use this directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to make the request to. |
required |
params
|
dict
|
Python dictionary of query parameters to send with the request. |
None
|
json
|
dict
|
Python dictionary of JSON-serializable data to send with the request. |
None
|
files
|
dict
|
Python dictionary of files to send with the request. |
None
|
timeout
|
float
|
Number of seconds to wait for the request to complete. |
60
|
Returns:
Name | Type | Description |
---|---|---|
Result |
Result
|
A Result object containing the status code, message, and data from the request. |
Source code in pyzipline/rest_adapter.py
post(endpoint, headers=None, params=None, json=None, files=None, timeout=60)
Make a POST request to the Zipline server. You should almost never have to use this directly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint
|
str
|
The endpoint to make the request to. |
required |
headers
|
dict
|
Python dictionary of headers to send with the request. |
None
|
params
|
dict
|
Python dictionary of query parameters to send with the request. |
None
|
json
|
dict
|
Python dictionary of JSON-serializable data to send with the request. |
None
|
files
|
dict
|
Python dictionary of files to send with the request. |
None
|
timeout
|
float
|
Number of seconds to wait for the request to complete. |
60
|
Returns:
Name | Type | Description |
---|---|---|
Result |
Result
|
A Result object containing the status code, message, and data from the request. |