-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to gh-pages from @ 733a7e0 🚀
- Loading branch information
Showing
20 changed files
with
1,031 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
_sources/autoapi/pyorderly/outpack/location_http/index.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
pyorderly.outpack.location_http | ||
=============================== | ||
|
||
.. py:module:: pyorderly.outpack.location_http | ||
Classes | ||
------- | ||
|
||
.. autoapisummary:: | ||
|
||
pyorderly.outpack.location_http.OutpackHTTPClient | ||
pyorderly.outpack.location_http.OutpackLocationHTTP | ||
|
||
|
||
Functions | ||
--------- | ||
|
||
.. autoapisummary:: | ||
|
||
pyorderly.outpack.location_http.raise_http_error | ||
|
||
|
||
Module Contents | ||
--------------- | ||
|
||
.. py:function:: raise_http_error(response: requests.Response) | ||
.. py:class:: OutpackHTTPClient(url: str, authentication=None) | ||
Bases: :py:obj:`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]> | ||
|
||
|
||
.. py:method:: request(method, path, *args, **kwargs) | ||
Constructs a :class:`Request <Request>`, prepares it and sends it. | ||
Returns :class:`Response <Response>` object. | ||
|
||
:param method: method for the new :class:`Request` object. | ||
:param url: URL for the new :class:`Request` object. | ||
:param params: (optional) Dictionary or bytes to be sent in the query | ||
string for the :class:`Request`. | ||
:param data: (optional) Dictionary, list of tuples, bytes, or file-like | ||
object to send in the body of the :class:`Request`. | ||
:param json: (optional) json to send in the body of the | ||
:class:`Request`. | ||
:param headers: (optional) Dictionary of HTTP Headers to send with the | ||
:class:`Request`. | ||
:param cookies: (optional) Dict or CookieJar object to send with the | ||
:class:`Request`. | ||
:param files: (optional) Dictionary of ``'filename': file-like-objects`` | ||
for multipart encoding upload. | ||
:param auth: (optional) Auth tuple or callable to enable | ||
Basic/Digest/Custom HTTP Auth. | ||
:param timeout: (optional) How long to wait for the server to send | ||
data before giving up, as a float, or a :ref:`(connect timeout, | ||
read timeout) <timeouts>` tuple. | ||
:type timeout: float or tuple | ||
:param allow_redirects: (optional) Set to True by default. | ||
:type allow_redirects: bool | ||
:param proxies: (optional) Dictionary mapping protocol or protocol and | ||
hostname to the URL of the proxy. | ||
:param hooks: (optional) Dictionary mapping hook name to one event or | ||
list of events, event must be callable. | ||
:param stream: (optional) whether to immediately download the response | ||
content. Defaults to ``False``. | ||
:param verify: (optional) Either a boolean, in which case it controls whether we verify | ||
the server's TLS certificate, or a string, in which case it must be a path | ||
to a CA bundle to use. Defaults to ``True``. When set to | ||
``False``, requests will accept any TLS certificate presented by | ||
the server, and will ignore hostname mismatches and/or expired | ||
certificates, which will make your application vulnerable to | ||
man-in-the-middle (MitM) attacks. Setting verify to ``False`` | ||
may be useful during local development or testing. | ||
:param cert: (optional) if String, path to ssl client cert file (.pem). | ||
If Tuple, ('cert', 'key') pair. | ||
:rtype: requests.Response | ||
|
||
|
||
|
||
.. py:class:: OutpackLocationHTTP(url: str, authentication=None) | ||
Bases: :py:obj:`pyorderly.outpack.location_driver.LocationDriver` | ||
|
||
|
||
A location implementation. | ||
|
||
The driver object is treated as a context manager and is entered and exited | ||
before and after its methods are called. | ||
|
||
|
||
.. py:method:: __enter__() | ||
Return `self` upon entering the runtime context. | ||
|
||
|
||
|
||
.. py:method:: __exit__(*args) | ||
Raise any exception triggered within the runtime context. | ||
|
||
|
||
|
||
.. py:method:: list() -> Dict[str, pyorderly.outpack.metadata.PacketLocation] | ||
.. py:method:: metadata(ids: List[str]) -> Dict[str, str] | ||
.. py:method:: fetch_file(packet: pyorderly.outpack.metadata.MetadataCore, file: pyorderly.outpack.metadata.PacketFile, dest: str) | ||
173 changes: 173 additions & 0 deletions
173
_sources/autoapi/pyorderly/outpack/location_packit/index.rst.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
pyorderly.outpack.location_packit | ||
================================= | ||
|
||
.. py:module:: pyorderly.outpack.location_packit | ||
Attributes | ||
---------- | ||
|
||
.. autoapisummary:: | ||
|
||
pyorderly.outpack.location_packit.GITHUB_CLIENT_ID | ||
pyorderly.outpack.location_packit.GITHUB_DEVICE_CODE_URL | ||
pyorderly.outpack.location_packit.GITHUB_ACCESS_TOKEN_URL | ||
|
||
|
||
Classes | ||
------- | ||
|
||
.. autoapisummary:: | ||
|
||
pyorderly.outpack.location_packit.DeviceAuthorizationResponse | ||
pyorderly.outpack.location_packit.AccessTokenResponse | ||
pyorderly.outpack.location_packit.ErrorResponse | ||
pyorderly.outpack.location_packit.OAuthDeviceClient | ||
|
||
|
||
Functions | ||
--------- | ||
|
||
.. autoapisummary:: | ||
|
||
pyorderly.outpack.location_packit.packit_authorisation | ||
pyorderly.outpack.location_packit.outpack_location_packit | ||
|
||
|
||
Module Contents | ||
--------------- | ||
|
||
.. py:data:: GITHUB_CLIENT_ID | ||
:value: 'Ov23liUrbkR0qUtAO1zu' | ||
|
||
|
||
.. py:data:: GITHUB_DEVICE_CODE_URL | ||
:value: 'https://github.com/login/device/code' | ||
|
||
|
||
.. py:data:: GITHUB_ACCESS_TOKEN_URL | ||
:value: 'https://github.com/login/oauth/access_token' | ||
|
||
|
||
.. py:class:: DeviceAuthorizationResponse | ||
Bases: :py:obj:`dataclasses_json.DataClassJsonMixin` | ||
|
||
|
||
DataClassJsonMixin is an ABC that functions as a Mixin. | ||
|
||
As with other ABCs, it should not be instantiated directly. | ||
|
||
|
||
.. py:attribute:: device_code | ||
:type: str | ||
|
||
|
||
.. py:attribute:: user_code | ||
:type: str | ||
|
||
|
||
.. py:attribute:: verification_uri | ||
:type: str | ||
|
||
|
||
.. py:attribute:: expires_in | ||
:type: int | ||
|
||
|
||
.. py:attribute:: interval | ||
:type: Optional[int] | ||
:value: None | ||
|
||
|
||
|
||
.. py:class:: AccessTokenResponse | ||
Bases: :py:obj:`dataclasses_json.DataClassJsonMixin` | ||
|
||
|
||
DataClassJsonMixin is an ABC that functions as a Mixin. | ||
|
||
As with other ABCs, it should not be instantiated directly. | ||
|
||
|
||
.. py:attribute:: access_token | ||
:type: str | ||
|
||
|
||
.. py:attribute:: token_type | ||
:type: str | ||
|
||
|
||
.. py:attribute:: expires_in | ||
:type: Optional[int] | ||
:value: None | ||
|
||
|
||
|
||
.. py:class:: ErrorResponse | ||
Bases: :py:obj:`dataclasses_json.DataClassJsonMixin` | ||
|
||
|
||
DataClassJsonMixin is an ABC that functions as a Mixin. | ||
|
||
As with other ABCs, it should not be instantiated directly. | ||
|
||
|
||
.. py:attribute:: error | ||
:type: str | ||
|
||
|
||
.. py:attribute:: error_description | ||
:type: Optional[str] | ||
:value: None | ||
|
||
|
||
|
||
.. py:class:: OAuthDeviceClient(client_id: str, device_code_url: str, access_token_url: str) | ||
.. py:method:: __enter__() | ||
.. py:method:: __exit__(*args) | ||
.. py:method:: authenticate(scope: str) -> AccessTokenResponse | ||
.. py:method:: start_device_authorization(scope: str) -> DeviceAuthorizationResponse | ||
Initiate the device authorization flow. | ||
|
||
This function returns a user code and verification URI which should be | ||
presented to the user. Additionally, it returns a device code which may | ||
be used to poll the access token endpoint until the authentication flow | ||
is complete. | ||
|
||
https://datatracker.ietf.org/doc/html/rfc8628#section-3.1 | ||
https://datatracker.ietf.org/doc/html/rfc8628#section-3.2 | ||
|
||
|
||
|
||
.. py:method:: fetch_access_token(parameters: DeviceAuthorizationResponse) -> Union[AccessTokenResponse, ErrorResponse] | ||
Fetch an access token from the authentication server. | ||
|
||
If authentication succeeds, an AccessTokenResponse is returned. | ||
Otherwise an ErrorResponse is returned. Depending on the error's code, | ||
the caller may call this function again (after a delay) to poll for new | ||
tokens. | ||
|
||
https://datatracker.ietf.org/doc/html/rfc8628#section-3.4 | ||
https://datatracker.ietf.org/doc/html/rfc8628#section-3.5 | ||
|
||
|
||
|
||
.. py:method:: poll_access_token(parameters: DeviceAuthorizationResponse) -> AccessTokenResponse | ||
.. py:function:: packit_authorisation(url: str, token: Optional[str]) -> Dict[str, str] | ||
.. py:function:: outpack_location_packit(url: str, token: Optional[str] = None) -> pyorderly.outpack.location_http.OutpackLocationHTTP | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.