dbr / tvdb_api

Simple to use interface to TheTVDB.com API in Python
The Unlicense
339 stars 63 forks source link

allow multiple values for 'language' language='de, en' #82

Closed kasi45 closed 4 years ago

kasi45 commented 4 years ago

Hello, i like your project very much!

if you change their sourcecode a little bit, then it would be possible to pass multiple values for 'Accept-Language' in the header.

for lang in language.split(','):
    if lang not in self.config['valid_languages']:
        raise ValueError(
            "Invalid language %s, options are: %s"
            % (lang, self.config['valid_languages'])
        )

greetings kasi45

dbr commented 4 years ago

Hmm, are you sure this works? The API docs say

https://api.thetvdb.com/swagger

TheTVDB API v3

Language selection is done via the Accept-Language header. At the moment, you may only pass one language abbreviation in the header at a time. Valid language abbreviations can be found at the /languages route..

Either way pull request #78 will remove that valid-language check stuff (instead deferring to letting TheTVDB itself error if passed something invalid), so this may work once those changes are merged

dbr commented 4 years ago

Closing - with the upcoming tvdb_api==3.1 release the validation of language has been removed and deferred to thetvdb.com itself - when it starts supporting comma separated languages, this should work:

>>> t = tvdb_api.Tvdb(..., language='en,fr')