moogar0880 / PyTrakt

A Pythonic interface to the Trakt.tv REST API
Other
64 stars 50 forks source link

trakt.init throws JSONDecodeError #146

Open glensc opened 3 years ago

glensc commented 3 years ago

This code throws JSONDecodeError

trakt.init(client_id='', client_secret='', store=True)

this library should catch and re-throw as an exception owned by this library.

so applications using this library can do "catch all trakt exceptions":


        client_id = click.prompt(PROMPT_TRAKT_CLIENT_ID, type=str)
        client_secret = click.prompt(PROMPT_TRAKT_CLIENT_SECRET, type=str)

        try:
            return trakt.init(client_id=client_id, client_secret=client_secret, store=True)
        except TraktException as e:
            click.echo(error(f"Log in to Trakt failed: {e}, Try again."))
glensc commented 1 year ago

Merged in my fork: