{"id":17197140,"url":"https://github.com/michaelhelmick/python-netflix","last_synced_at":"2025-07-21T09:33:28.539Z","repository":{"id":2178504,"uuid":"3125602","full_name":"michaelhelmick/python-netflix","owner":"michaelhelmick","description":"A Python Library to interface with Netflix REST API \u0026 OAuth","archived":false,"fork":false,"pushed_at":"2013-08-04T05:02:05.000Z","size":60,"stargazers_count":29,"open_issues_count":0,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-19T20:18:52.996Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michaelhelmick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-07T17:32:44.000Z","updated_at":"2025-02-24T09:55:14.000Z","dependencies_parsed_at":"2022-09-06T02:01:05.364Z","dependency_job_id":null,"html_url":"https://github.com/michaelhelmick/python-netflix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michaelhelmick/python-netflix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-netflix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-netflix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-netflix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-netflix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michaelhelmick","download_url":"https://codeload.github.com/michaelhelmick/python-netflix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michaelhelmick%2Fpython-netflix/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266276136,"owners_count":23903981,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T01:55:34.080Z","updated_at":"2025-07-21T09:33:28.522Z","avatar_url":"https://github.com/michaelhelmick.png","language":"Python","readme":"Python-Netflix\n==============\n\n`Python-Netflix` is a Python library to help interface with [Netflix REST API](http://developer.netflix.com/docs/REST_API_Reference \"Netflix REST API\") \u0026 OAuth\n\nInstallation\n------------\n``` $ pip install python-netflix```\n\nUsage\n-----\n\n###### Authorization URL\n```python\nn = NetflixAPI(api_key='*your app key*',\n               api_secret='*your app secret*',\n               callback_url='http://www.example.com/callback/')\n\nauth_props = n.get_authentication_tokens()\nauth_url = auth_props['auth_url']\n\n#Store this token in a session or something for later use in the next step.\noauth_token_secret = auth_props['oauth_token_secret']\n\nprint 'Connect with Netflix via %s' % auth_url\n```\n\nOnce you click \"Allow\" be sure that there is a URL set up to handle getting finalized tokens and possibly adding them to your database to use their information at a later date.'\n\n###### Handling the callback\n```python\n# In Django, you'd do something like\n# oauth_token = request.GET.get('oauth_verifier')\n# oauth_verifier = request.GET.get('oauth_verifier')\n\noauth_token = *Grab oauth token from URL*\noauth_verifier = *Grab oauth verifier from URL*\n\n#Initiate the NetflixAPI class in your callback.\nn = NetflixAPI(api_key='*your app key*',\n               api_secret='*your app secret*',\n               oauth_token=oauth_token,\n               oauth_token_secret=session['netflix_session_keys']['oauth_token_secret'])\n\nauthorized_tokens = n.get_auth_tokens(oauth_verifier)\n\nfinal_oauth_token = authorized_tokens['oauth_token']\nfinal_oauth_token_secret = authorized_tokens['oauth_token_secret']\nfinal_user_id = authorized_tokens['user_id']\n\n# Save those tokens and user_id to the database for a later use?\n```\n\n###### Return a list of the users Instant Queue.\n```python\n# Get the final tokens from the database or wherever you have them stored\n\nn = NetflixAPI(api_key = '*your app key*',\n               api_secret = '*your app secret*',\n               oauth_token=final_tokens['oauth_token'],\n               oauth_token_secret=final_tokens['oauth_token_secret'])\n\n\ninstant_queue = n.get('users/*final_user_id*/queues/instant')\nprint instant_queue\n```\n\n###### Add Gabriel Iglesias: Hot and Fluffy to Instant Queue\n```python\ntry:\n    add_to_queue = n.post('users/*final_user_id*/queues/instant', params={'title_ref': 'http://api.netflix.com/catalog/titles/movies/70072945'})\n\n    print add_to_queue\n\n    # You can also added \"position\" to the params to set where this media will be positioned on the users queue.\nexcept NetflixAPIError:\n    # This returns the added item if successful.\n    # If it's already in the queue, it will return a NetflixAPIError, code 412\n```\n\n###### Remove Gabriel Iglesias: Hot and Fluffy to Instant Queue\n```python\n# When querying for the users Queue, when iterating over the Queue items\n# you can use the 'id' for the next call. Where it says *final_user_id*\n# that is automatically returned from the Netflix Instant Queue response.\ndel_from_queue = n.delete('http://api-public.netflix.com/users/*final_user_id*/queues/instant/available/2/70072945')\n\nprint del_from_queue\n```\n\n###### Rate Gabriel Iglesias: Hot and Fluffy\n```python\ntry:\n    # Create a new rating\n    create_rating = n.post('users/*final_user_id*/ratings/title/actual/70072945', params={'rating': '5'})\n\n    print create_rating\nexcept NetflixAPIError:\n    # This returns a status message if successful.\n    # If it's already been rated, it will return a NetflixAPIError, code 422\n    pass\n\n\n# Update/Clear rating\nupdate_rating = n.put('users/*final_user_id*/ratings/title/actual/70072945', params={'rating': 'no_opinion'})\n\nprint update_rating\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhelmick%2Fpython-netflix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichaelhelmick%2Fpython-netflix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichaelhelmick%2Fpython-netflix/lists"}