{ "info": { "author": "Kenko", "author_email": "kenko.py@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "======\r\nREADME\r\n======\r\n\r\nThese are four contents.\r\n\r\n- Required_\r\n- Installation_\r\n- Tutorial_\r\n- `Sample Code`_\r\n\r\nWhat is changed from version 0.1.0 to 0.2.0\r\n=============================================\r\n\r\n- Using json data in version 0.2.0\r\n- You can use more methods in version 0.2.0 than 0.1.0\r\n- Especially, you can use search methods in version 0.2.0 \r\n\r\n\r\n\r\nRequired\r\n==========\r\n\r\nTwitter_oauth requires Python 2.x superior to 2.5.\r\n\r\n\r\nThese modules are required.\r\n\r\n- oauth2\r\n\r\nIf you use python 2.5, you also need\r\n\r\n- simplejson\r\n\r\n\r\nInstallation\r\n==============\r\n\r\nOn Linux.\r\n\r\ninstall simplejson\r\n-------------------\r\n\r\nIf you use Python 2.x superior to Python 2.6, skip `install simplejson`_ and go to `install twitter_oauth`_\r\n\r\n\r\nIf you use python2.5, you should install simplejson first.\r\n\r\nDownload simplejson from `http://pypi.python.org/pypi/simplejson/`_\r\n\r\n.. _`http://pypi.python.org/pypi/simplejson/`: http://pypi.python.org/pypi/simplejson/\r\n\r\nThen, change the directory which contains simplejson file, and \r\n\r\n\r\n::\r\n\r\n $ tar vxzf simplejson-2.1.1.tar.gz\r\n $ cd simplejson-2.1.1\r\n $ sudo python setup.py install\r\n\r\n\r\ninstall twitter_oauth\r\n---------------------\r\n\r\nFrom PyPI:\r\n\r\n::\r\n\r\n $ sudo easy_install twitter_oauth\r\n\r\n\r\nTutorial\r\n========\r\n\r\nOAuth\r\n------\r\n\r\nFirst, you shold have two keys, \r\n'consumer key', 'consumer secret'.\r\n\r\nIf you don't have 'consumer key' and 'consumer secret', \r\nyou cat get these keys to register your application to Twitter.\r\nYou cat register your application at next URL.\r\n\r\n`http://twitter.com/apps`_\r\n\r\n.. _`http://twitter.com/apps`: http://twitter.com/apps\r\n\r\n\r\n\r\n\r\nThen, you shold get two keys, 'oauth_token', and 'oauth_token_secret'\r\n\r\nTo get these keys, you use GetOauth class in this module.\r\n\r\n::\r\n\r\n >>> import twitter_oauth\r\n\r\n >>> # write your key and secret\r\n >>> consumer_key = '***'\r\n >>> consumer_secret = '***'\r\n \r\n >>> get_oauth_obj = twitter_oauth.GetOauth(consumer_key, consumer_secret)\r\n\r\n\r\nThen, you get 'oauth_token' and 'oauth_token_secret' by using get_oauth method.\r\nThis method returns a dictionary that contain 'consumer key', 'consumer secret',\r\n'oauth_token' and 'oauth_token_secret'\r\n\r\n::\r\n\r\n >>> get_oauth_obj.get_oauth()\r\n Request Token:\r\n - oauth_token = ***\r\n - oauth_token_secret = ***\r\n Go to the following link in your browser\r\n http://twitter.com/oauth/authorize?oauth_token=***\r\n \r\n What is the PIN? ***\r\n Access Token:\r\n - oauth_token = ***\r\n - oauth_token_secret = ***\r\n \r\n You may now access protected resources using the access token above\r\n \r\n \r\nApi class\r\n----------\r\n \r\nNow, you can use twitter_oauth.Api class.\r\nTo use this class, you can post update, or get friends timeline, etc...\r\n \r\nNext example is how to use twitter_oauth.Api class\r\n\r\n::\r\n\r\n >>> # import twitter_oauth module\r\n >>> import twitter_oauth\r\n \r\n >>> # write yoru consumer_key, consumer_secret,\r\n >>> # oauth_token, oauth_token_secret\r\n >>> consumer_key = '***'\r\n >>> consumer_secret = '***'\r\n >>> oauth_token = '***'\r\n >>> oauth_token_secret = '***'\r\n\r\n >>> # Then, create Api instance\r\n\r\n >>> api = twitter_oauth.Api(consumer_key, consumer_secret,\r\n >>> oauth_token, oauth_token_secret)\r\n\r\nUse get_friends_timeline method.\r\nYou can get friends timeline to use this method.\r\n\r\n::\r\n\r\n >>> friends_timeline = api.get_friends_timeline()\r\n >>> print [stauts.text for status in friends_timeline]\r\n \r\n Use get_user_timeline method.\r\n You can get user timeline to use this method.\r\n \r\n >>> user_timeline = api.get_user_timeline()\r\n >>> print [stauts.text for status in user_timeline]\r\n \r\n Use get_replies method.\r\n You can get replies to use this method.\r\n \r\n >>> replies = api.get_replies()\r\n >>> print [stauts.text for status in replies]\r\n\r\n\r\nUse post_update method \r\nYou can post message to Twitter.\r\n\r\nCAUTION : post_update method shold take a unicode.\r\nEspecially, you can post a Japanese text.\r\n\r\n::\r\n\r\n >>> api.post_update(tweet=u'Hello, Twitter')\r\n\r\nUse get_list_status method.\r\n\r\n::\r\n\r\n >>> # write username and list name \r\n >>> api.get_list_status(user='username', list_id='listname')\r\n >>> print [status.text for status in api.get_list_status(user=\"username\", list_id=\"listname\")]\r\n\r\n\r\nUse search method\r\n\r\nIf you want to show tweets including 'keyword', \r\n\r\n::\r\n\r\n >>> search_obj = api.search(q='keyword')\r\n >>> print [tweet_info.text for tweet_info in search_obj.results]\r\n\r\n\r\nIf you want to show tweets including 'keyword' and 'anotherkeyword', \r\n\r\n::\r\n\r\n >>> search_obj = api.search(q='keyword anotherkeyword')\r\n >>> print [tweet_info.text for tweet_info in search_obj.results]\r\n\r\n\r\nIf you want to show tweets including 'keyword' or 'anotherkeyword', \r\n\r\n::\r\n\r\n >>> search_obj = api.search(q='keyword OR anotherkeyword')\r\n >>> print [tweet_info.text for tweet_info in search_obj.results]\r\n\r\nIf you want to show timeline from 'user', \r\n\r\n::\r\n\r\n >>> search_obj = api.search(q='from:user')\r\n >>> print [tweet_info.text for tweet_info in search_obj.results]\r\n\r\nIf you want to show tweets to 'user', then\r\n\r\n::\r\n\r\n >>> search_obj = api.search(q='to:user')\r\n >>> print [tweet_info.text for tweet_info in search_obj.results]\r\n\r\nIf you want to show tweets from 'user' to 'another', then\r\n\r\n::\r\n\r\n >>> search_obj = api.search(q='from:user to:another')\r\n >>> print [tweet_info.text for tweet_info in search_obj.results]\r\n\r\nIf you want to search tag, \r\n\r\n::\r\n\r\n >>> search_obj = api.search(q='#twitter')\r\n >>> print [tweet_info.text for tweet_info in search_obj.results]\r\n\r\n\r\nTo know more information about a search method, see the next link.\r\n\r\n`http://dev.twitter.com/doc/get/search`_\r\n\r\n.. _`http://dev.twitter.com/doc/get/search`: http://dev.twitter.com/doc/get/search\r\n\r\nMethods\r\n-------\r\n\r\n\r\nYou can use next methods\r\n\r\n- status\r\n \r\n - post_update()\r\n - show_status()\r\n - destroy_status()\r\n\r\n- timeline\r\n\r\n - get_user_timeline()\r\n - get_friends_timeline()\r\n - get_replies()\r\n\r\n- list\r\n\r\n - get_list_status()\r\n\r\n- friendship\r\n\r\n - create_friendship()\r\n - destroy_friendship()\r\n\r\n- user\r\n\r\n - search_user()\r\n - show_user()\r\n\r\n- search\r\n\r\n - search()\r\n\r\n\r\n\r\nSample Code\r\n===========\r\n\r\n::\r\n\r\n #! /usr/bin/env python\r\n # coding:utf-8\r\n \r\n import twitter_oauth\r\n \r\n # write your oauth token and oauth token secret\r\n consumer_key = '***'\r\n consumer_secret = '***'\r\n \r\n # create GetOauth instance\r\n get_oauth_obj = twitter_oauth.GetOauth(consumer_key, consumer_secret)\r\n \r\n # get oauth_token and oauth token secret\r\n key_dict = get_oauth_obj.get_oauth()\r\n \r\n # create Api instance\r\n api = twitter_oauth.Api(consumer_key, consumer_secret, key_dict['oauth_token'], key_dict['oauth_token_secret'])\r\n\r\n \r\n ## timeline method\r\n \r\n # get friends timeline\r\n print [status.text for status in api.get_friends_timeline()]\r\n \r\n # get user timeline\r\n print [status.text for status in api.get_user_timeline()]\r\n \r\n # get replies\r\n print [status.text for status in api.get_replies()]\r\n\r\n\r\n ## status method\r\n \r\n # post update\r\n api.post_update(tweet=u'Hello, Twitter')\r\n\r\n # show status and destroy status\r\n status = api.get_user_timeline()[0]\r\n\r\n print api.show_status(id=status.id).text\r\n api.destroy_status(id=status.id)\r\n\r\n\r\n ## friendship method\r\n\r\n api.create_friendship(id='twitter')\r\n api.destroy_friendship(id='twitter')\r\n \r\n \r\n ## user method \r\n print api.show_user(id='twitter').screen_name\r\n print [user.screen_name for user in api.search_user(q='twitter')]\r\n\r\n\r\n ## search method\r\n \r\n print [tweet_info.text for tweet_info in api.search(q='#twitter').results]", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.google.com/p/twitter-oauth", "keywords": "Twitter,Oauth", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "twitter_oauth", "package_url": "https://pypi.org/project/twitter_oauth/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/twitter_oauth/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://code.google.com/p/twitter-oauth" }, "release_url": "https://pypi.org/project/twitter_oauth/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "A Python module for Twitter API and OAuth", "version": "0.2.0" }, "last_serial": 801091, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "6f3d3b56990a55f21df413e022985f25", "sha256": "8802fa2ad598972b358ebb59752871e965d646ad97754c00fc299b9884fa397d" }, "downloads": -1, "filename": "twitter_oauth-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6f3d3b56990a55f21df413e022985f25", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13644, "upload_time": "2010-09-11T01:06:07", "url": "https://files.pythonhosted.org/packages/96/86/0d6b1666c2a61308790f4a0b87c9fb68efc083246c92bff18045952e2537/twitter_oauth-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "8caaffa7e59b8a4efb3b70b675496736", "sha256": "6377d0b2b3c938aeb0ff04b365e547a3d31f9cb76a57b662c89b45ba7df86153" }, "downloads": -1, "filename": "twitter_oauth-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8caaffa7e59b8a4efb3b70b675496736", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10311, "upload_time": "2010-10-24T11:09:53", "url": "https://files.pythonhosted.org/packages/c2/8b/436f9d222047b3f5b2feeba0799e797910055dc6a7622d899ba248cb9ef3/twitter_oauth-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8caaffa7e59b8a4efb3b70b675496736", "sha256": "6377d0b2b3c938aeb0ff04b365e547a3d31f9cb76a57b662c89b45ba7df86153" }, "downloads": -1, "filename": "twitter_oauth-0.2.0.tar.gz", "has_sig": false, "md5_digest": "8caaffa7e59b8a4efb3b70b675496736", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10311, "upload_time": "2010-10-24T11:09:53", "url": "https://files.pythonhosted.org/packages/c2/8b/436f9d222047b3f5b2feeba0799e797910055dc6a7622d899ba248cb9ef3/twitter_oauth-0.2.0.tar.gz" } ] }