oasislmf.platform_api.session¶
Classes¶
A Requests session. |
Module Contents¶
- class oasislmf.platform_api.session.APISession(api_url, username, password, timeout=25, retries=5, retry_delay=1, request_interval=0.02, logger=None, **kwargs)[source]¶
Bases:
requests.Session
A Requests session.
Provides cookie persistence, connection-pooling, and configuration.
Basic Usage:
>>> import requests >>> s = requests.Session() >>> s.get('https://httpbin.org/get') <Response [200]>
Or as a context manager:
>>> with requests.Session() as s: ... s.get('https://httpbin.org/get') <Response [200]>
- get(url, **kwargs)[source]¶
Sends a GET request. Returns
Response
object.- Parameters:
url – URL for the new
Request
object.**kwargs – Optional arguments that
request
takes.
- Return type:
requests.Response
- post(url, **kwargs)[source]¶
Sends a POST request. Returns
Response
object.- Parameters:
url – URL for the new
Request
object.data – (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the
Request
.json – (optional) json to send in the body of the
Request
.**kwargs – Optional arguments that
request
takes.
- Return type:
requests.Response
- delete(url, **kwargs)[source]¶
Sends a DELETE request. Returns
Response
object.- Parameters:
url – URL for the new
Request
object.**kwargs – Optional arguments that
request
takes.
- Return type:
requests.Response
- put(url, **kwargs)[source]¶
Sends a PUT request. Returns
Response
object.- Parameters:
url – URL for the new
Request
object.data – (optional) Dictionary, list of tuples, bytes, or file-like object to send in the body of the
Request
.**kwargs – Optional arguments that
request
takes.
- Return type:
requests.Response