pyorderly.outpack.location_packit

Attributes

GITHUB_CLIENT_ID

GITHUB_DEVICE_CODE_URL

GITHUB_ACCESS_TOKEN_URL

Classes

DeviceAuthorizationResponse

DataClassJsonMixin is an ABC that functions as a Mixin.

AccessTokenResponse

DataClassJsonMixin is an ABC that functions as a Mixin.

ErrorResponse

DataClassJsonMixin is an ABC that functions as a Mixin.

OAuthDeviceClient

Functions

packit_authorisation(→ dict[str, str])

outpack_location_packit(...)

Module Contents

pyorderly.outpack.location_packit.GITHUB_CLIENT_ID = 'Ov23liUrbkR0qUtAO1zu'
pyorderly.outpack.location_packit.GITHUB_DEVICE_CODE_URL = 'https://github.com/login/device/code'
pyorderly.outpack.location_packit.GITHUB_ACCESS_TOKEN_URL = 'https://github.com/login/oauth/access_token'
class pyorderly.outpack.location_packit.DeviceAuthorizationResponse

Bases: dataclasses_json.DataClassJsonMixin

DataClassJsonMixin is an ABC that functions as a Mixin.

As with other ABCs, it should not be instantiated directly.

device_code: str
user_code: str
verification_uri: str
expires_in: int
interval: int | None = None
class pyorderly.outpack.location_packit.AccessTokenResponse

Bases: dataclasses_json.DataClassJsonMixin

DataClassJsonMixin is an ABC that functions as a Mixin.

As with other ABCs, it should not be instantiated directly.

access_token: str
token_type: str
expires_in: int | None = None
class pyorderly.outpack.location_packit.ErrorResponse

Bases: dataclasses_json.DataClassJsonMixin

DataClassJsonMixin is an ABC that functions as a Mixin.

As with other ABCs, it should not be instantiated directly.

error: str
error_description: str | None = None
class pyorderly.outpack.location_packit.OAuthDeviceClient(client_id: str, device_code_url: str, access_token_url: str)
__enter__()
__exit__(*args)
authenticate(scope: str) AccessTokenResponse
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

fetch_access_token(parameters: DeviceAuthorizationResponse) 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

poll_access_token(parameters: DeviceAuthorizationResponse) AccessTokenResponse
pyorderly.outpack.location_packit.packit_authorisation(url: str, token: str | None) dict[str, str]
pyorderly.outpack.location_packit.outpack_location_packit(url: str, token: str | None = None) pyorderly.outpack.location_http.OutpackLocationHTTP