Comments (5)
@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.
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.
@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.
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.
Thanks for your help.
I am nearly there, but just getting stuck with the whole PIN thing.
from trakt.py.
Related Issues (20)
- Search query return all matching items even if the year parameter is passed
- watched attribute always None in Episode HOT 2
- Watchlist get all HOT 4
- Expose ratings endpoint
- Add extended info for user list items HOT 1
- Limit results from trending movies requests HOT 2
- Continue previous session HOT 3
- How do I add an episode/movie to history with `watched_at='released'`? HOT 1
- Support querying for user list items by type HOT 1
- Implement friends and following for users
- Implement users/id/watchlist and users/id/collection
- Implement lists/trending and lists/popular HOT 3
- Regression in version 4.x HOT 6
- Issues with Trakt HOT 10
- Rate limiting HOT 2
- Add support for Popular/Recommended Movies/Shows HOT 4
- ReadTimeout Error HOT 3
- "Images" is None when using extended=full HOT 1
- Update requirements? HOT 2
- [Help] How to mark an episode as watched ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from trakt.py.