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.
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.
Installing requests is simple with pip:
$ pip install pyflix2
or, with easy_install:
$ easy_install pyflix2
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
andshared_secret
needs to be obtained from: http://developer.netflix.com/apps/mykeys. - The
access_token
,access_token_secret
needs to be obtained programmatically usingget_request_token
andget_access_token
- Here
$ python -mpyflix2 -s 'the matrix' -x
Or see help:
$ python -mpyflix2 -h
- 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.