Skip to main content

Python Library to interact with LibLynx

Project description

LibLynx Python Library

Python Library to interact with LibLynx https://www.liblynx.com/

Usage example:

import liblynx

CLIENT_ID = "< your ID >"
CLIENT_SECRET = "< your SECRET >"
ll = liblynx.Connect(CLIENT_ID, CLIENT_SECRET)

# or just,
ll = liblynx.Connect()    # Then the ENV Variables LIBLYNX_CLIENT_ID and LIBLYNX_CLIENT_SECRET are used

print(ll.access_token)
print(ll.endpoint)
# Note how the .access_token and .endpoint attribute access results in a cached lookup

identification1 = ll.new_identification("127.0.0.127", "https://example.com/foo/", "Python-LibLynx-Testing/0.1")

ll.api("new account", c.endpoint["_links"]["@new_account"]["href"], "POST", {"account_name":"Some Account", "subscriptions":[{"title":"Foo", "start": "2020-11-01 10:56:58", "end": "2020-12-01 10:56:58"}]})

The environment variable LIBLYNX_BASE is checked for specifying a BASE URL, for example:

export LIBLYNX_BASE=https://connect.liblynx.com

if not found it uses: https://sandbox.liblynx.com

Middlewares

This library currently contains some integraitons with popular frameworks, Django and Starlette.

Django

To use the middleware, add it to the django.conf.MIDDLEWARE entry in the Django project settings file.

If a request can be identified, the attached LibLynx account name is stored in the session under the key LIBLYNX_ACCOUNT and the account id is stored in LIBLYNX_ACCOUNT_ID

It is optional (and normally highly desirable) to add the following settings;

LIBLYNX_FETCH_PRODUCTS : this will retrieve all the Content Units for the identified account, and add it to the request session under the LIBLYNX_PRODUCTS key.

Starlette

Documentation in progress, this middleware is subject to modification. It might be desirable to unify the session-based account retrieval in the same way as the Django middleware.

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

LibLynx-0.16.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

LibLynx-0.16-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file LibLynx-0.16.tar.gz.

File metadata

  • Download URL: LibLynx-0.16.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0

File hashes

Hashes for LibLynx-0.16.tar.gz
Algorithm Hash digest
SHA256 ce255b19293c79e62c00c7a1ef47d3e3b56f57a08931ce6d13981267d83c7b0c
MD5 609fcf135e30f1af6b29707c58e32221
BLAKE2b-256 995075d7601316577a64440dfd9af4bcefe977622bb0b2a25c4d84e35cf07ede

See more details on using hashes here.

File details

Details for the file LibLynx-0.16-py3-none-any.whl.

File metadata

  • Download URL: LibLynx-0.16-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.0

File hashes

Hashes for LibLynx-0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 d4967bdf0eb646983ccd600ad933384782222f9b93134bd16f45ea837a9e2222
MD5 1cb0a52eac175cbd3fdb2c0e6338018f
BLAKE2b-256 0bff14b0e3429e089dc5ce3e04a4e0d052d35e4c7f1f66c92c736334e37236d8

See more details on using hashes here.

Supported by

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