GithubHelp home page GithubHelp logo

Comments (5)

fuzeman avatar fuzeman commented on June 3, 2024 1

@plittlefield You need to authenticate with your Trakt.tv account.

For example:

from trakt import Trakt


# Configure client
Trakt.configuration.defaults.app(
    id='<APP ID>'  # (e.g. "478" for https://trakt.tv/oauth/applications/478)
)

Trakt.configuration.defaults.client(
    id='<CLIENT ID>',
    secret='<CLIENT SECRET>'
)

# Request authentication
print('Navigate to %s' % Trakt['oauth/pin'].url())
pin = raw_input('Pin: ')

# Exchange `pin` for an account authorization token
authorization = Trakt['oauth'].token_exchange(pin, 'urn:ietf:wg:oauth:2.0:oob')

if not authorization or not authorization.get('access_token'):
    print('ERROR: Authentication failed')
    exit(1)

# Configure client to use your account `authorization` by default
Trakt.configuration.defaults.oauth.from_response(authorization)

# Fetch watched items
for key, movie in Trakt['sync/watched'].movies().items():
    print('%s (%s)' % (movie.title, movie.year))

Note: PIN authentication has been deprecated, but it does still work and is the easiest authentication method to use.

from trakt.py.

fuzeman avatar fuzeman commented on June 3, 2024

trakt.py was built for https://github.com/trakt/Plex-Trakt-Scrobbler, so it currently only supports the scrobble and sync methods of the API.

I'm planning on implementing the rest of the API, but currently don't have much time to work on this.

from trakt.py.

razzeee avatar razzeee commented on June 3, 2024

@fuzeman thank you.
I'm using it for the kodi plug in port too. So if I'm growing to like python I will add some pull requests here.

That being said, is there a way in your wrapper to convert the media objects it hands out to json, compatible to Trakt?
I probably missed it somewhere

from trakt.py.

plittlefield avatar plittlefield commented on June 3, 2024

Hello All,

I would like to use this on the Linux command line, in a similar fashion to FlexGet, to be able to list and remove shows.

I have pulled with git, run travis_install.sh, run sudo python setup.py install.

I have created an API and put the 'id' and 'secret' in a simple python file.

from trakt import Trakt
Trakt.configuration.defaults.client(
    id='blablabla',
    secret='blablabla'
)
watched = Trakt['sync/watched'].movies()
for key, show in watched.items():
    print '%s (%s)' % (show.title, show.year)

I have just used the 'Retrieve shows that a user has watched' example, but it is not working for me.

The error is:-

Traceback (most recent call last):
  File "trakt_.py", line 12, in <module>
    for key, show in watched.items():
AttributeError: 'NoneType' object has no attribute 'items'

Can anyone help?

Thanks,

Paully

from trakt.py.

plittlefield avatar plittlefield commented on June 3, 2024

Thanks for your help.

I am nearly there, but just getting stuck with the whole PIN thing.

from trakt.py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.