Skip to main content

Python interface for the Trakt.tv API

Project description

https://img.shields.io/pypi/v/trakt.py.svg?style=flat-square https://img.shields.io/travis/fuzeman/trakt.py.svg?style=flat-square https://img.shields.io/codeclimate/github/fuzeman/trakt.py.svg?style=flat-square https://img.shields.io/coveralls/fuzeman/trakt.py.svg?style=flat-square

Python interface for the Trakt.tv API.

Install

pip install trakt.py

Examples

Configure the client

from trakt import Trakt


Trakt.configuration.defaults.client(
    id='<client-id>',
    secret='<client-secret>'
)

Scrobble an episode

show = {
    'title': 'Community',
    'year': 2009
}

episode = {
    'season': 5,
    'number': 13
}

# Send "start" event
Trakt['scrobble'].start(
    show=show,
    episode=episode,

    progress=1
)

# [...] (watching episode)

# Send "stop" event (scrobble)
Trakt['scrobble'].stop(
    show=show,
    episode=episode,

    progress=93
)

Add a movie to your collection

Trakt['sync/collection'].add({
    'movies': [
        {
            'title': "Twelve Monkeys",
            'year': 1995,

            'ids': {
                'imdb': "tt0114746"
            }
        }
    ]
})

Retrieve shows that a user has watched

# `watched` = {<key>: <Show>} dictionary
watched = Trakt['sync/watched'].movies()

for key, show in watched.items():
    print '%s (%s)' % (show.title, show.year)

License

The MIT License (MIT)

Copyright (c) 2014 Dean Gardiner

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trakt.py-4.4.0.tar.gz (438.2 kB view details)

Uploaded Source

Built Distribution

trakt.py-4.4.0-py2.py3-none-any.whl (77.7 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file trakt.py-4.4.0.tar.gz.

File metadata

  • Download URL: trakt.py-4.4.0.tar.gz
  • Upload date:
  • Size: 438.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.1

File hashes

Hashes for trakt.py-4.4.0.tar.gz
Algorithm Hash digest
SHA256 760ae97dcea8781e00a31a4f0b790f4fae63f15a2b03480fad872eaa668dc4cc
MD5 7b1311e0ab0587bc99e716ce64f39f67
BLAKE2b-256 422e372d116e18f94d7c94d4f479eab073d0acabcd08e9f36dc337802c02ff0c

See more details on using hashes here.

File details

Details for the file trakt.py-4.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: trakt.py-4.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 77.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.1

File hashes

Hashes for trakt.py-4.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 bc0953fbd01e553fe99fe7534cf3e901fa53d94ed23acb28641ce79bc117578b
MD5 d4c0a73025427962bc3c22f3b400edc6
BLAKE2b-256 7eae0f355442ad923725814687104f6ea94b1d38357bbb4df783e5f7ae13a212

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page