Content1 Authentication API

The content1_auth module provides authentication mechanisms for the 1WorldSync Content1 API.

Content1HMACAuth

class oneworldsync.content1_auth.Content1HMACAuth(app_id, secret_key, gln=None)[source]

Bases: object

HMAC Authentication for 1WorldSync Content1 API

This class handles the HMAC authentication process required by the 1WorldSync Content1 API. It generates the necessary hash code based on the request parameters and secret key.

__init__(app_id, secret_key, gln=None)[source]

Initialize the HMAC authentication with app_id and secret_key

Parameters:
  • app_id (str) – The application ID provided by 1WorldSync

  • secret_key (str) – The secret key provided by 1WorldSync

  • gln (str, optional) – Global Location Number for the user

generate_timestamp()[source]

Generate a timestamp in the format required by the 1WorldSync Content1 API

Returns:

Timestamp in ISO 8601 format (YYYY-MM-DDThh:mm:ssZ)

Return type:

str

generate_hash(uri)[source]

Generate a hash code for the given URI using HMAC-SHA256

Parameters:

uri (str) – The URI to hash

Returns:

Base64-encoded hash code

Return type:

str

generate_auth_headers(uri)[source]

Generate authentication headers for a request

Parameters:

uri (str) – The URI part of the URL (path + query parameters)

Returns:

Headers containing authentication information

Return type:

dict