Giter Site home page Giter Site logo

yatinla / pyflix2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from amalakar/pyflix2

0.0 1.0 0.0 194 KB

Python module for accessing Netflix APIs

Home Page: http://pyflix2.readthedocs.org/en/latest/

License: BSD 2-Clause "Simplified" License

Python 100.00%

pyflix2's Introduction

pyflix2: python module for accessing Netflix webservice

Notes from yatinla

This is a fork of the pyflix2 library from amalakar's github repository. Thanks to those who have contributed for all the work.

However, when I first tried to use this pyflix2 library from it did not work for me. It didn't seem to be compatible with the Netflix API (wrong urls which I think must have changed) but more importantly it did not work with the latest requests library. For example it seemed to expect to pass hooks to the requests.Session() class when creating a session. Apparently this incompatibility results from major non-backward compatible changes made to the kennethreitz requests library for Version 1.0.0. In particular it seems like all hooks except response hooks were removed. I found that amalakar had forked requests and that if I used his fork things were much better.

However, I still experienced issues with the OAuth authentication when I tried to retrieve protected user info using the full 3-legged OAuth authentication. This was using the requests-oauth library from maraujop's github repository. It turned out that the oauth-hook module was adding the 'output=json' query parameter to the URL and then after that apparently the requests library was adding it again which caused Netflix to report an invalid signature when I tried to access the /users/current API. I found the easy way to fix that was to fork the maraujop oath-hooks library and modify it so that it does not add the parameter too (although it must still use it when computing the signature of course).

So after these changes I am now at least getting past the oauth however it seems like the format of the json data returned has also changed and so my own sample apps do not yet work fully at the time of this writing. Hopefully I'll solve those issues and push a new revision soon.

So in order to use this pyflix2 fork you will have to also get my fork of the requests module (or at least the equivalent version from kennethreitz respository) and my fork of the oath-hooks library.

Introduction

pyflix2 is a BSD licensed python module for accessing netflix API (both v1 and v2) Netflix provides REST interfaces to access it's catalog and various user data. This module exposes easy to use object oriented interfaces that is inteded to make it even easier for python programmers to use.

Install

Installing requests is simple with pip:

$ pip install pyflix2

or, with easy_install:

$ easy_install pyflix2

Example

from pyflix2 import *

netflix = NetflixAPIV2( 'appname', 'key', 'shared_secret')
movies = netflix.title_autocomplete('Terminator', filter='instant')
for title in movies['autocomplete']['title']:
    print title

user = netflix.get_user('access_token', 'access_token_secret')
reco = user.get_reccomendations()
for movie in reco['recommendations']:
    print movie['title']['regular']
Note
  • Here appname, key and shared_secret needs to be obtained from: http://developer.netflix.com/apps/mykeys.
  • The access_token, access_token_secret needs to be obtained programmatically using get_request_token and get_access_token

Commandline

$ python -mpyflix2 -s 'the matrix' -x

Or see help:

$ python -mpyflix2 -h

Features

  • Supports both V1 and V2 of netflix REST API
  • Supports both out-of-bound (oauth 1.0a) and vanila three legged oauth auhentication
  • Provides easy to use and well documented functional interface for all the API exposed by netflix
  • Throws Exception for all kinds of error situation making it easier to integrate with other program
  • V1 and V2 APIs are exposed using different classes, so version specific features can be used easily
  • Internally uses Requests for making HTTP calls
  • Want any new feature? please file a feature request

Documentation: http://pyflix2.readthedocs.org/en/latest/index.html

Note: I would like to thank Kirsten Jones for the library http://code.google.com/p/pyflix/ As pyflix2 was initially inspired by pyflix.

pyflix2's People

Contributors

amalakar avatar

Watchers

James Cloos avatar

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.