A tvdb version2 API client, generated using swagger's codegen
- For ease of demonstration i've configured the following variables before going into the API's methods.
base_url = 'https://api.thetvdb.com'
client_id = 'username' # (optional! Only required for the /user routes)
client_secret = 'pass' # (optional! Only required for the /user routes)
apikey = "0629B785CE550C8D"
- Import the tvdbapiv2 package
import tvdbapiv2
- Setup the authentication string thats needed later:
authentication_string = {"apikey":apikey, "username":"", "userpass":""}
- Create a unauthenticated client instance:
unauthenticated_client = tvdbapiv2.ApiClient(base_url)
- Create an AuthenticationApi object instance
auth_api = tvdbapiv2.AuthenticationApi(unauthenticated_client)
- Get the Bearer token using the authentication_string
access_token = auth_api.login_post(authentication_string)
- Setup the authenticated client instance:
auth_client = tvdbapiv2.ApiClient(base_url, 'Authorization', 'Bearer ' + access_token.token)
- Now your able to use the API's query endpoints like:
tvdbapiv2.SearchApi(auth_client).search_series_get(name='Breaking Bad')
tvdbapiv2.SeriesApi(auth_client).series_id_get(80379)