luxerone package

Module contents

Unofficial LuxerOne API Python client.

Submodules

luxerone.client module

Client for interacting with the LuxerOne Residential API

class luxerone.client.AuthTokenDetails(token: str, ttl: int)

Bases: object

Abstraction layer for working with token details.

Parameters:
  • token – auth token.

  • ttl – time to live in seconds.

is_expired() bool

Whether the token has expired.

Returns:

true if expired, else false.

class luxerone.client.LuxerOneClient(username: str = None, password: str = None, auth_token_details: AuthTokenDetails = None)

Bases: object

Unofficial LuxerOne Python client.

Parameters:
  • username – Optional username. If one is not provided, LuxerOneClient.login() must be called manually or a token must be provided.

  • password – The password associated with the provided username.

  • auth_token_details – Optional parameter. If no username or password is provided, an existing AuthTokenDetails can be used.

get_long_lived_token(ttl: int = 18000000) AuthTokenDetails

Gets a long-lived API auth token. Must have received an auth token prior to making this call by either supplying your own or providing your login credentials to the class constructor or by calling LuxerOneClient.login().

Please note that there appears to be a bug with the server-side logout functionality, resulting in LuxerOneClient.logout() having no affect. It is not advised to create long-lived tokens as there is no way to invalidate them until Luxer One fixes this issue.

One the request for the long-lived token has been processed, the token used by the client will be automatically be changed to use the new token and the prior auth token will be invalidated.

Parameters:

ttl – time to live in seconds for the long-lived token. Max value is 18000000 (208.3 days)

Raises:
  • RequestNotAuthenticatedException – when called without having an auth token set.

  • TokenExpiredException – when an expired auth token is used.

  • LuxerOneAPIException – when the API call fails unexpectedly.

Returns:

the auth token details for the long-lived-token.

get_package_history() list[HistoricalPackage]

Gets a history of all packages received includes pending packages. Seems to be limited to last 50.

Raises:
  • RequestNotAuthenticatedException – when called without having an auth token set.

  • TokenExpiredException – when an expired auth token is used.

  • LuxerOneAPIException – when the API call fails unexpectedly.

Returns:

a list of the last 50 packages.

get_pending_packages() list[Package]

Gets the list of current packages that have been delivered but not picked up.

Raises:
  • RequestNotAuthenticatedException – when called without having an auth token set.

  • TokenExpiredException – when an expired auth token is used.

  • LuxerOneAPIException – when the API call fails unexpectedly.

Returns:

a list of packages that are pending pickup

get_user_info() UserInfo

Returns a UserInfo object containing the information for the authenticated user.

Raises:
  • RequestNotAuthenticatedException – when called without having an auth token set.

  • TokenExpiredException – when an expired auth token is used.

  • LuxerOneAPIException – when the API call fails unexpectedly.

Returns:

User Information.

login(username: str, password: str, ttl: int = 300) None

Gets an API auth token to submit requests.

Parameters:
  • username – Username

  • password – Password

  • ttl – Time to live for the token in seconds. Defaults to 300 (five minutes) with a max of 1800 (thirty minutes).

Raises:

LuxerOneAPIException – when failure to login occurs.

logout() dict | None

Logout from the LuxerOne API. This will invalidate (in theory) the auth token that is being used by the client, so be careful when calling this method if you are using a long-lived token. Testing has shown that calling logout does not appear to invalidate the token.

Raises:
  • RequestNotAuthenticatedException – when called without having an auth token set.

  • LuxerOneAPIException – when the API call fails unexpectedly.

Returns:

logout response or None if the token is already expired.

static reset_password(email: str) None

Requests a reset password email.

Parameters:

email – email of the account to reset the password for.

update_user_settings(form: UpdateUserSettingsForm) dict

Changes user settings. Keys are values from LuxerOneClient.get_user_info() Not all options are changeable.

This is still a work in progress and will eventually provide wrapper classes for manipulating user information.

Parameters:

form – UpdateUserSettingsForm, any field left blank will not be modified.

Raises:
  • RequestNotAuthenticatedException – when called without having an auth token set.

  • TokenExpiredException – when an expired auth token is used.

  • LuxerOneAPIException – when the API call fails unexpectedly.

Returns:

the api response.

luxerone.package module

Wrapper classes for all information relating to package deliveries.

class luxerone.package.Carrier(package_data: dict)

Bases: object

Carrier information.

class luxerone.package.HistoricalPackage(package_data: dict)

Bases: Package

Historical Package information.

class luxerone.package.Location(package_data: dict)

Bases: object

Location information regarding the package delivery location.

class luxerone.package.Locker(package_data: dict)

Bases: object

Locker information.

class luxerone.package.Package(package_data: dict)

Bases: object

Package information.

luxerone.user module

Wrapper classes for all information relating to the user.

class luxerone.user.UserInfo(user_info: dict)

Bases: object

Class representing the user information.

class luxerone.user.UserInfoLocation(all_locations_data: dict)

Bases: object

Delivery location information associated with a user.

class Location(location_info: dict)

Bases: object

Location information.

class LocationUser(location_user_info: dict)

Bases: object

Class representing the Location of a user for the UserInfo object.