Package: client-for-tvdb
client-for-tvdbA simple client for theTvdb API v3.Getting StartedThese 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.PrerequisitesTvdb AccountYou will need an API key from TVDb.com to access the client. To obtain a
key, follow these steps:Registerfor and verify an account.Log intoyour account.Fill your detailsto generate a new API key.Python Installation (recommended to use a virtual env)You also need python >= 3.6 up and running. If your OS does not have the
appropriate python version, you could installpyenvand create a virtual environment with the proper python version. Also you will
need an up to date pip installation (version20.0.2or greater is our
recommendation). So once you havepyenvinstalled
(seepyenv install instructions),
make an virtual environment for the project (we will use python version 3.8):pyenv virtualenv 3.8.1 client-for-tvdbEnter inside the python environment we recently created (client-for-tvdb):pyenv activate client-for-tvdbUpgradepippackage:pip install --upgrade pipInstallpoetrypackage:pip install poetryInstallingOnce you have the prerequisites installed, you can proceed installing the
project. The project uses anpyproject.tomlfile to manage the installation
(PEP517) and also we will make use of the python packagepoetryas ourbuild-system(PEP518). So, to do the install you only need tocdto the
project folder:cd client-for-tvdbAnd run the install of the dependencies viapoetrycommand:poetry installRunning API clientTo use this tvdb API client, first you must initialize the client with
the proper credentials:fromclient_for_tvdbimportTvdbClienttvdb_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.envfile which should be located inside theclient_for_tvdbmodule (or you couldexportthem):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.envfile:To get a list of possible matching tvshows:fromclient_for_tvdbimportTvdbClienttvdb_client=TvdbClient()# get a list of dictionaries with tvshows from the TVDB APIsearch_result=tvdb_client.search("Game of Thrones")To get only the closest matching tvshow:fromclient_for_tvdbimportTvdbClienttvdb_client=TvdbClient()# will return a dictionarysearch_result=tvdb_client.search_closest_matching("Game of Thrones")You also could perform a query supplying atvdb_idfromclient_for_tvdbimportTvdbClienttvdb_client=TvdbClient()# will return a dictionarysearch_result=tvdb_client.get_serie_by_id(121361)Running the testsTo run our project tests you can usepytestwith coverage:PYTHONPATH=. pytest tests/ --cov client_for_tvdb/Built WithPython 3- The programming languagePoetry- Dependency ManagementContributingPlease readCONTRIBUTING.mdfor details on our code of
conduct, and the process for submitting pull requests to us.VersioningWe useCalVerfor versioning. For the versions available,
see thetags on this repository.AuthorsPol Canelles-Initial work-opacamSee also the list ofcontributorswho participated in this project.LicenseThis project is licensed under the MIT License - see theLICENSE.mdfile for detailsAcknowledgmentsTvdb API docs