Skip to main content

client-for-tvdb

CI codecov Python versions GitHub release GitHub tag PyPI version fury.io GitHub license

A simple client for the Tvdb API v3.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

Tvdb Account

You will need an API key from TVDb.com to access the client. To obtain a key, follow these steps:

You also need python >= 3.6 up and running. If your OS does not have the appropriate python version, you could install pyenv and create a virtual environment with the proper python version. Also you will need an up to date pip installation (version 20.0.2 or greater is our recommendation). So once you have pyenv installed (see pyenv install instructions), make an virtual environment for the project (we will use python version 3.8):

pyenv virtualenv 3.8.1 client-for-tvdb

Enter inside the python environment we recently created (client-for-tvdb):

pyenv activate client-for-tvdb

Upgrade pip package:

pip install --upgrade pip

Install poetry package:

pip install poetry

Installing

Once you have the prerequisites installed, you can proceed installing the project. The project uses an pyproject.toml file to manage the installation (PEP517) and also we will make use of the python package poetry as our build-system (PEP518). So, to do the install you only need to cd to the project folder:

cd client-for-tvdb

And run the install of the dependencies via poetry command:

poetry install

Running API client

To use this tvdb API client, first you must initialize the client with the proper credentials:

from client_for_tvdb import TvdbClient

tvdb_client = TvdbClient(
    user_name="Your user name",
    user_key="Your user key",
    api_key="Your API key"
)

Also you could setup your credentials via environment variables, wrote in .env file which should be located inside the client_for_tvdb module (or you could export them):

TVDB_USER_NAME=<Your user name>
TVDB_USER_KEY=<Your user key>
TVDB_API_KEY=<Your API key>

You can perform the following queries, assuming that you have setup your credentials via .env file:

  • To get a list of possible matching tvshows:

    from client_for_tvdb import TvdbClient
    
    tvdb_client = TvdbClient()
    # get a list of dictionaries with tvshows from the TVDB API
    search_result = tvdb_client.search("Game of Thrones")
    
  • To get only the closest matching tvshow:

    from client_for_tvdb import TvdbClient
    
    tvdb_client = TvdbClient()
    # will return a dictionary
    search_result = tvdb_client.search_closest_matching("Game of Thrones")
    
  • You also could perform a query supplying a tvdb_id

    from client_for_tvdb import TvdbClient
    
    tvdb_client = TvdbClient()
    # will return a dictionary
    search_result = tvdb_client.get_serie_by_id(121361)
    

Running the tests

To run our project tests you can use pytest with coverage:

PYTHONPATH=. pytest tests/ --cov client_for_tvdb/

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use CalVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Pol Canelles - Initial work - opacam

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

Metadata

Release files for client-for-tvdb 2020.5.24

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

Source distribution (sdist)

Source distribution for client-for-tvdb 2020.5.24
File Size Uploaded Provenance Actions
client-for-tvdb-2020.5.24.tar.gz 7.4 kB Without provenance Details for client-for-tvdb-2020.5.24.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for client-for-tvdb 2020.5.24
File Interpreter ABI Platform Actions
client_for_tvdb-2020.5.24-py3-none-any.whl Python 3 none any Details for client_for_tvdb-2020.5.24-py3-none-any.whl

Total release size: 15.1 kB

Release files / client-for-tvdb-2020.5.24.tar.gz

Download URL client-for-tvdb-2020.5.24.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e469aee7fa893fadd5d007600159ef3d29401ec486b4fabf745d961e49794db3
BLAKE2b-256 checksum
How to use checksums
624e06ab28bc234281565e90c0dfeb351b50f319ec8dac9ea772df7b0b0b2678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Release files / client_for_tvdb-2020.5.24-py3-none-any.whl

Download URL client_for_tvdb-2020.5.24-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e3b64ccb934cbc001939965e419d0afb54129052121a91886354231ebbebbbb4
BLAKE2b-256 checksum
How to use checksums
78c228ac52763c600940bfc6a6601980fddd22a6925af4a629e2668f2d3d2e76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7

Security for client-for-tvdb 2020.5.24

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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