{"id":13502633,"url":"https://github.com/litl/rauth","last_synced_at":"2025-05-14T00:10:52.636Z","repository":{"id":2618424,"uuid":"3602702","full_name":"litl/rauth","owner":"litl","description":"A Python library for OAuth 1.0/a, 2.0, and Ofly.","archived":false,"fork":false,"pushed_at":"2022-06-26T18:20:47.000Z","size":30942,"stargazers_count":1600,"open_issues_count":39,"forks_count":174,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-04-10T03:44:58.023Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://readthedocs.org/docs/rauth/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/litl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-02T14:18:54.000Z","updated_at":"2025-03-20T12:50:50.000Z","dependencies_parsed_at":"2022-08-06T12:30:46.908Z","dependency_job_id":null,"html_url":"https://github.com/litl/rauth","commit_stats":null,"previous_names":[],"tags_count":47,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litl%2Frauth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litl%2Frauth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litl%2Frauth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/litl%2Frauth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/litl","download_url":"https://codeload.github.com/litl/rauth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254044369,"owners_count":22005146,"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-07-31T22:02:20.523Z","updated_at":"2025-05-14T00:10:47.627Z","avatar_url":"https://github.com/litl.png","language":"Python","readme":"# Rauth\n\nA simple Python OAuth 1.0/a, OAuth 2.0, and Ofly consumer library built on top\nof Requests.\n\n[![build status](https://secure.travis-ci.org/litl/rauth.png?branch=master)](https://travis-ci.org/#!/litl/rauth)\n\n\n## Features\n\n* Supports OAuth 1.0/a, 2.0 and [Ofly](http://www.shutterfly.com/documentation/start.sfly)\n* Service wrappers for convenient connection initialization\n* Authenticated session objects providing nifty things like keep-alive\n* Well tested (100% coverage)\n* Built on [Requests](https://github.com/kennethreitz/requests) (v1.x)\n\n\n## Installation\n\nTo install:\n\n    $ pip install rauth\n\nOr if you must:\n\n    $ easy_install rauth\n\n\n## Example Usage\n\nLet's get a user's Twitter timeline. Start by creating a service container \nobject:\n\n```python\nfrom rauth import OAuth1Service\n\n# Get a real consumer key \u0026 secret from https://dev.twitter.com/apps/new\ntwitter = OAuth1Service(\n    name='twitter',\n    consumer_key='J8MoJG4bQ9gcmGh8H7XhMg',\n    consumer_secret='7WAscbSy65GmiVOvMU5EBYn5z80fhQkcFWSLMJJu4',\n    request_token_url='https://api.twitter.com/oauth/request_token',\n    access_token_url='https://api.twitter.com/oauth/access_token',\n    authorize_url='https://api.twitter.com/oauth/authorize',\n    base_url='https://api.twitter.com/1.1/')\n```\n\nThen get an OAuth 1.0 request token:\n\n```python\nrequest_token, request_token_secret = twitter.get_request_token()\n```\n\nGo through the authentication flow.  Since our example is a simple console\napplication, Twitter will give you a PIN to enter.\n\n```python\nauthorize_url = twitter.get_authorize_url(request_token)\n\nprint 'Visit this URL in your browser: ' + authorize_url\npin = raw_input('Enter PIN from browser: ')  # `input` if using Python 3!\n```\n\nExchange the authorized request token for an authenticated `OAuth1Session`:\n\n```python\nsession = twitter.get_auth_session(request_token,\n                                   request_token_secret,\n                                   method='POST',\n                                   data={'oauth_verifier': pin})\n```\n\nAnd now we can fetch our Twitter timeline!\n\n```python\nparams = {'include_rts': 1,  # Include retweets\n          'count': 10}       # 10 tweets\n\nr = session.get('statuses/home_timeline.json', params=params)\n\nfor i, tweet in enumerate(r.json(), 1):\n    handle = tweet['user']['screen_name']\n    text = tweet['text']\n    print(u'{0}. @{1} - {2}'.format(i, handle, text))\n```\n\nHere's the full example: [examples/twitter-timeline-cli.py](https://github.com/litl/rauth/blob/master/examples/twitter-timeline-cli.py).\n\n\n## Documentation\n\nThe Sphinx-compiled documentation is available here: [http://readthedocs.org/docs/rauth/en/latest/](http://readthedocs.org/docs/rauth/en/latest/)\n\n\n## Contribution\n\nAnyone who would like to contribute to the project is more than welcome.\nBasically there's just a few steps to getting started:\n\n1. Fork this repo\n2. Make your changes and write a test for them\n3. Add yourself to the AUTHORS file and submit a pull request!\n\nNote: Before you make a pull request, please run `make check`. If your code\npasses then you should be good to go! Requirements for running tests are in\n`requirements-dev@\u003cpython-version\u003e.txt`. You may also want to run `tox` to\nensure that nothing broke in other supported environments, e.g. Python 3.\n\n## Copyright and License\n\nRauth is Copyright (c) 2013 litl, LLC and licensed under the MIT license.\nSee the LICENSE file for full details.\n","funding_links":[],"categories":["Authentication","资源列表","Python","Authentication and OAuth","Awesome Python"],"sub_categories":["验证","Authentication"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitl%2Frauth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flitl%2Frauth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flitl%2Frauth/lists"}