Skip to main content

LPSN API

Using the LPSN API requires registration. Registration is free but the usage of LPSN data is only permitted when in compliance with the LPSN copyright. See the LPSN copyright notice for details.

For questions, requests and comments regarding the LPSN API, please use the LPSN contact form.

Please register here.

The Python package can be initialized using your login credentials:

import lpsn

client = lpsn.LpsnClient('name@mail.example', 'password')

# the prepare method fetches all LPSN-IDs matching your query
# and returns the number of IDs found
count = client.search(taxon_name='Sulfolobus', correct_name='yes')
print(count, 'entries found.')

# the retrieve method lets you iterate over all results
# and returns the full entry as dict
# Entries can be further filtered using a list of keys (e.g. ['keywords'])
for entry in client.retrieve():
    print(entry)

Example queries:

You can use IDs to query LPSN as described here. Note that when using the parameter id, all other parameters are ignored.

# Search by LPSN-IDs (either semicolon separated or as list):
query = {"id": 520424}
query = {"id": "520424;4948;17724"}
query = {"id": [520424, 4948, 17724]}

# run query
client.search(**query)

Or you can use all the advanced search parameters that are described here.

Note that dashes (-) are replaced by underscores when used as python parameters.

# Example looking for validly published names of species in the genus Escherichia that have risk group 1:
client.search(taxon_name='Escherichia', category='species', riskgroup='1', validly_published='yes')

# The same example using a Python dictionary:
query = {
    'taxon-name': 'Escherichia', 
    'category': 'species',
    'riskgroup': '1',
    'validly-published': 'yes'
}
client.search(**query)

Filtering

Results from the retrieve Method of both clients can be further filtered. The result contains a list of matched keyword dicts:

result = client.retrieve(filter=["full_name", "lpsn_taxonomic_status"])
print({k:v for x in result for k,v in x.items()})

The printed result will look like this:

{782310: [{'full_name': 'Sulfolobus acidocaldarius'},
          {'lpsn_taxonomic_status': 'correct name'}],
 782311: [{'full_name': 'Sulfolobus brierleyi'},
          {'lpsn_taxonomic_status': 'synonym'}],
 782312: [{'full_name': 'Sulfolobus hakonensis'},
          {'lpsn_taxonomic_status': 'synonym'}],
 782313: [{'full_name': 'Sulfolobus metallicus'},
          {'lpsn_taxonomic_status': 'synonym'}],
...

Known issues

This package depends on python-keycloak for authorization and login handling. However, python-keycloak seems to have issues with older versions of requests and urllib3. See the related issue on github. This might lead to the following error when trying to access the API:

AttributeError: 'Retry' object has no attribute 'allowed_methods'

You might be able to resolve this issue by updating the mentioned libraries, e.g. via pip:

pip install requests>=2.25.1 urllib3>=1.26.5

Download files

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

Source Distribution

lpsn-0.1.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

lpsn-0.1.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file lpsn-0.1.1.tar.gz.

File metadata

  • Download URL: lpsn-0.1.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for lpsn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f9c0d2a68332e510948e5635033e338e2a8de647fe8ebca79b693cb0fb66c5f6
MD5 5450d4e846c2cb5ffb2176ebcc8fef2e
BLAKE2b-256 34c11ae3edb5da80cb06d86e07c184ce13b5425c9fe7f008c4fbea90c50895d5

See more details on using hashes here.

File details

Details for the file lpsn-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lpsn-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.3

File hashes

Hashes for lpsn-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 19b287061e3e1e9c7a271d1687b725a8210d3163fc5722cfe272a901c0335a6d
MD5 dc3bf452d4747cb8c9b5d23b88709cc9
BLAKE2b-256 3d60b6ae079ca2529c15d20fd749eb41ac43a0776612be395e48726817acc219

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.0

2 files

This release

0.1.1 This release

2 files

0.1

2 files

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