Skip to main content

Python client library for the Geni.com public REST API

Project description

Geni: Python Client Library for Geni.com Public REST API

Test codecov Lint TypeCheck

This library simplifies interaction with the Geni.com public REST API, enabling developers to automate various family tree management tasks or integrate Geni functionality into their Python applications. Specifically, it helps post-process your family tree after importing a GEDCOM file.

Features

  • Simplifies API interaction.
  • Implements OAuth authentication flow.
  • Handles Geni's required rate-limiting automatically.
  • Stores API keys and tokens for ease of use.
  • Provides examples for common use cases.

Installation

Use the following command to install the library directly from GitHub:

pip install git+https://github.com/bryndin/geni.git

Usage Examples

See the examples directory.

Implemented Methods

The library currently supports the following methods:

  • Profile
    • profile: Returns information about a profile.
    • add-child: Add a child to a profile and return the added profile.
    • add-parent: Add a parent to a profile and return the added profile.
    • add-partner: Add a partner to a profile and return the added profile.
    • add-sibling: Add a sibling to a profile and return the added profile.
    • delete: Deletes a profile.
    • update_basics: Update fields on the basics and about tabs and return the changed profile. Parameters can be posted as form data or JSON.
  • Stats
    • stats: Returns information about the site.
    • world_family_tree: Returns information about the world family tree.
  • User

Additional methods are planned for future releases. Contributions are welcome!

Authentication

To interact with the Geni API, you need to authenticate using OAuth 2.0. Follow these steps:

  1. Register your application at Geni.com App Registration.

  2. Copy your API Key.

  3. Make your key available in one of the following ways:

    • Store your API Key in a file named geni_api.key in your working directory,

    • or pass your API key as a parameter during the library initialization.

  4. During the first run, you will be prompted to authorize your application:

    1. In the terminal window the library will give you the URL to Geni Auth page
      Visit this URL to authorize the application:
      https://www.geni.com/platform/oauth/authorize?client_id=XXXXXXXX&response_type=token&display=desktop
      Paste the redirect URL (from the address bar):
      
    2. Open it in any browser and authorize your application in Geni.
      Geni Auth Page Screenshot
    3. After authorization, Geni will redirect you to a "Not Found" page. This is expected behavior. Copy the entire URL from the browser address bar and paste it in the terminal.
      Geni Redirect URL Location Screenshot
    4. The library will extract the access token from that redirected URL and save it to a temporary file geni_token.tmp.
  5. Each subsequent request will use the access token from the temporary file, until the token expires or the file is manually removed.

  6. If the access token is expired, the library will ask you to re-authenticate before continuing with the request (expiration time is also stored in the temporary file).

Sensitive files

The library uses two files:

  • geni_api.key: Created manually to store your API key.
  • geni_token.tmp: Created by the library to store the temporary API access token.

Ensure these files are secured and not exposed in version control systems. These files must be manually deleted when no longer needed.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geniapi-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geniapi-0.1.0-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file geniapi-0.1.0.tar.gz.

File metadata

  • Download URL: geniapi-0.1.0.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for geniapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2254ea85d444a8ae55012ce6fa97beade6493f2d2ae5ec47054499fc7ebdeb71
MD5 a27965cdf5995f906769b46d9a74791c
BLAKE2b-256 5b104759dd4b04343f367368dbecfa6739cef3b0accb45eef7edc37c22852b0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for geniapi-0.1.0.tar.gz:

Publisher: pypi.yaml on bryndin/geni

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geniapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: geniapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for geniapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9dab74c20d535bb26e11c585b8bc9a76efa5d369b98ac8e8d3bebba13897b771
MD5 0041049f729ab3384c476595e7392fd1
BLAKE2b-256 7aa044a9c51d0cd48f17690eff2db82afd7187c471b613370ac5fba071371806

See more details on using hashes here.

Provenance

The following attestation bundles were made for geniapi-0.1.0-py3-none-any.whl:

Publisher: pypi.yaml on bryndin/geni

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page