Skip to main content

PyPI Version Documentation Status Python 3.11+ License AGPL-3.0-or-later Tests codecov CodeFactor

EternalTwin Python Client

eternaltwinpy is an unofficial Python client for the EternalTwin API. It let you authenticate and retrieve users information.

You can view the full documentation at https://eternaltwinpy.readthedocs.io/en/latest/.

Features

  • Provides a high-level API to make authorization and user information retrieval easier.
  • Provides a low-level API to interact directly with the EternalTwin API.
  • Support both synchronous and asynchronous HTTP requests.

Requirements

eternaltwinpy supports the officially supported versions of Python (mainstream & LTS).

Installation

Install via pip:

pip install eternaltwin

or poetry:

poetry add eternaltwin

Quickstart

Configure the connection

See Configuration for more details.

from eternaltwin.connections import configure
from eternaltwin.keys import HS256Key

ETERNALTWIN_CONFIG = {
    "default": {
        'url': 'https://eternaltwin.org/api/v1/',
        'client_id': "myclient",
        'client_secret': 'mysecret',
        'redirect_uri': 'https://myapp.com/callback',
        'state_key': HS256Key("mykey"),
        'allow_redirects': True,
    },
    "test": {
        'url': 'http://localhost:50321/api/v1"',
        'client_id': "myclient",
        'client_secret': 'mysecret',
        'redirect_uri': 'https://localhost:8080/callback',
        'state_key': HS256Key("mykey"),
        'timeout': 1,
        'verify_ssl': False,
    }
}
configure(**ETERNALTWIN_CONFIG)

Oauth2 Authorization

See OAuth2 Authorization for more details.

from eternaltwin.users import User
from eternaltwin.exceptions import InvalidStateError

# Generate a state and an authorization URL.
# The state can be used to find which auth request the response corresponds to
# if the callback is handled by a different thread, worker, or process than the
# one that created the auth request.
state, url = User.start_authorization()

# Redirect the user to the url, once authenticated EternalTwin will redirect
# back to your `redirect_uri` with additional query parameters `code` and `state`.
authorization_code =  # Extract the `code`
response_state =  # Extract the `state`

# Ensure the state is as expected to prevent CSRF attacks. 
try:
    user = User.from_authorization_code(authorization_code, response_state, state)
except InvalidStateError:
    ...

assert user.is_authenticated is True
print(user.identifier)
# "<user_id>"
print(user.username)
# "<username>"

Retrieving User Information

See Working with Users for more details.

from eternaltwin.users import User

# Get a specific user by ID
user = User.get("<user_id>")
print(user.identifier)
# "<user_id>"
print(user.username)
# "Bob"

# Search for users by username
users = User.search("Jhon")

Metadata

Release files for eternaltwin 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for eternaltwin 1.0.0
File Size Uploaded Provenance Actions
eternaltwin-1.0.0.tar.gz 22.6 kB With provenance Details for eternaltwin-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for eternaltwin 1.0.0
File Interpreter ABI Platform Actions
eternaltwin-1.0.0-py3-none-any.whl Python 3 none any Details for eternaltwin-1.0.0-py3-none-any.whl

Total release size: 52.1 kB

Release files / eternaltwin-1.0.0.tar.gz

Download URL eternaltwin-1.0.0.tar.gz
Size 22.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e54c89f9006f9292e0db6983e4a8fa468f22d672f03940fb9656724fb4eb5d19
BLAKE2b-256 checksum
How to use checksums
9d2db17f7d301b442f5bcee9178d5a2d965fa4bc890bb5e2ac02160ae9263f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

Release files / eternaltwin-1.0.0-py3-none-any.whl

Download URL eternaltwin-1.0.0-py3-none-any.whl
Size 29.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93d44daf07272f80e4583dba27f3e34045293d214f7558604037a5f34e258f0f
BLAKE2b-256 checksum
How to use checksums
e3c9c9b4b91cd8c9a3af16857d1bd758e0b8cdd69f4c3baff3b98a41772dad24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

Security for eternaltwin 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for eternaltwin-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page