{ "info": { "author": "mookrs", "author_email": "mookrs+fanpy@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: MIT License", "Natural Language :: Chinese (Simplified)", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Communications :: Chat :: Internet Relay Chat", "Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries", "Topic :: Utilities" ], "description": "# fanpy\n\n[![Coverage Status](https://coveralls.io/repos/github/mookrs/fanpy/badge.svg?branch=master)](https://coveralls.io/github/mookrs/fanpy?branch=master)\n\n`fanpy` is a Python tool that allows you to interact with [fanfou.com](http://fanfou.com/). This project is a clone from sixohsix's [Python Twitter Tools](https://github.com/sixohsix/twitter).\n\n## \u5b89\u88c5\n\n`pip(3) install fanpy`\n\n## fanpy\n\n`fanpy` \u662f\u4e00\u4e2a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u53ef\u5b9e\u73b0\u4ee5\u4e0b\u529f\u80fd\uff1a\n\n- \u67e5\u770b\u4e2a\u4eba\u65f6\u95f4\u8f74\uff08friends\uff09\u548c\u6536\u5230\u7684\u56de\u590d\uff08replies\uff09\uff0c\u5e76\u4ee5\u4e0d\u540c\u7684\u683c\u5f0f\u8f93\u51fa\n- \u4f7f\u7528\u5173\u952e\u8bcd\u641c\u7d22\uff08search\uff09\u6d88\u606f\n- \u5173\u6ce8\uff08follow\uff09\u548c\u53d6\u5173\uff08leave\uff09\u597d\u53cb\n- \u53d1\u9001\uff08set\uff09\u65b0\u6d88\u606f\n\n\u8f93\u5165 `fanpy -h` \u67e5\u770b\u66f4\u591a\u5e2e\u52a9\u3002\n\n## fanpy-archiver\n\n`fanpy-archiver` \u53ef\u4ee5\u5907\u4efd\u4f60\u7684\u6d88\u606f\u3001\u6536\u5230\u7684\u56de\u590d\u3001\u79c1\u4fe1\u3001\u6536\u85cf\uff0c\u4ed6\u4eba\u7684\u6d88\u606f\u3001\u6536\u85cf\u3002\u8f93\u5165 `fanpy-archiver -h` \u67e5\u770b\u66f4\u591a\u5e2e\u52a9\u3002\u8be5\u5de5\u5177\u4ec5\u4f9b\u6d4b\u8bd5\uff0c\u5982\u679c\u60f3\u66f4\u597d\u5730\u5907\u4efd\u6d88\u606f\uff0c\u63a8\u8350\u4f7f\u7528 Windows \u4e0b\u8d85\u65b9\u4fbf\u7684 [\u996d\u76d2](http://www.aoisnow.net/blog/fanhe)\u3002\n\n## fanpy-log\n\n`fanpy-log` \u53ef\u4ee5\u5728\u7ec8\u7aef\u663e\u793a\u67d0\u4e2a\u7528\u6237\u7684\u5168\u90e8\u6d88\u606f\u3002\u8f93\u5165 `fanpy-log -h` \u67e5\u770b\u66f4\u591a\u5e2e\u52a9\u3002\n\n## \u4e0e Fanfou API \u4ea4\u4e92\n\n\u996d\u5426 API \u6587\u6863\u8bf7\u53c2\u8003\uff1a\n\nhttps://github.com/FanfouAPI/FanFouAPIDoc/wiki\n\n\u793a\u4f8b\uff1a\n\n```python\nfrom fanpy import *\n\nf = Fanfou(auth=OAuth(\n oauth_token, oauth_token_secret, consumer_key, consumer_secret))\n\n# Get your home timeline\nf.statuses.home_timeline()\n\n# Get a particular friend's timeline\n# To pass in the GET/POST parameter `id` you need to use `_id`\nf.statuses.user_timeline(_id='ifanfou')\n\n# To pass in GET/POST parameters, such as `count`\nf.statuses.home_timeline(count=5)\n\n# Update your status\nf.statuses.update(status='Hello, world!')\n\n# Send a direct message\nf.direct_messages.new(user='ifanfou', text='I miss you!')\n\n# An *optional* `_timeout` parameter can also be used for API\n# calls which take much more time than normal:\nf.search.public_timeline(q='|'.join(A_LIST_OF_100_WORDS), _timeout=1)\n\n# Overriding Method: GET/POST\n# you should not need to use this method as this library properly\n# detects whether GET or POST should be used, Nevertheless\n# to force a particular method, use `_method`\nt.statuses.update(status='Hello, world!', _method='POST')\n\n\n# Send image with your status:\n# - Just read image from the web or from file the regular way:\nwith open('example.png', 'rb') as imagefile:\n imagedata = imagefile.read()\n# - Then send the image with a status.\nfanfou.photos.upload(photo=imagedata, status='Upload image.')\n```\n\n### \u4f7f\u7528\u8fd4\u56de\u7684\u6570\u636e\n\n\u8c03\u7528\u996d\u5426 API \u540e\u9ed8\u8ba4\u8fd4\u56de JSON \u5bf9\u8c61\uff0c\u5e76\u88ab\u81ea\u52a8\u8f6c\u6362\u6210 `list` \u6216 `dict`\uff1a\n\n```python\nx = fanfou.statuses.home_timeline()\n\n# The first status in the timeline\nx[0]\n\n# The name of the user who wrote the first status\nx[0]['user']['name']\n```\n\n### \u83b7\u53d6 XML \u6570\u636e\n\n\u5982\u679c\u4f60\u9700\u8981\u83b7\u53d6 XML \u683c\u5f0f\u7684\u6570\u636e\uff0c\u53ef\u4ee5\u5728\u521d\u59cb\u5316 Fanfou \u5bf9\u8c61\u65f6\u4f20\u5165 `format='xml'` \u53c2\u6570:\n\n```python\nfanfou = Fanfou(format='xml')\n```\n\n## \u6388\u6743\n\n\u652f\u6301\u901a\u8fc7 OAuth \u8fdb\u884c\u6388\u6743\u3002\n\n### OAuth \u7684\u8ba4\u8bc1\u6d41\u7a0b\n\n\u8bbf\u95ee\u996d\u5426\u5f00\u653e\u5e73\u53f0\u5e76\u521b\u5efa\u5e94\u7528\uff1a\n\nhttp://fanfou.com/apps.new\n\n\u521b\u5efa\u6210\u529f\u540e\uff0c\u4f60\u5c06\u4f1a\u5f97\u5230 `CONSUMER_KEY` \u548c `CONSUMER_SECRET`\u3002\n\n\u7528\u6237\u5728\u8fd0\u884c\u4f60\u7684\u7a0b\u5e8f\u65f6\uff0c\u9700\u8981\u5c06\u8d26\u6237\u6388\u6743\u7ed9\u4f60\u7684\u5e94\u7528\u3002\u5177\u4f53\u7684\u5b9e\u73b0\u8bf7\u67e5\u770b `fanpy.oauth_dance` \u6a21\u5757\u3002\u5982\u679c\u4f60\u7f16\u5199\u7684\u662f\u547d\u4ee4\u884c\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 `oauth_dance()` \u51fd\u6570\u3002\n\n\u6267\u884c `oauth_dance()` \u5c06\u83b7\u5f97\u6388\u6743\u6240\u5fc5\u9700\u7684 oauth token \u548c oauth token secret\uff0c\u53ef\u4ee5\u5c06\u8fd9\u4e9b\u4fe1\u606f\u4fdd\u5b58\u5728\u672c\u5730\uff0c\u4e4b\u540e\u5c31\u4e0d\u7528\u91cd\u590d\u6388\u6743\u6b65\u9aa4\u4e86\u3002\n\n`read_token_file()` \u548c `write_token_file()` \u662f\u8bfb\u53d6\u548c\u5199\u5165 oauth token \u548c oauth token secret \u7684\u65b9\u6cd5\uff0c\u5176\u503c\u4ee5\u5b57\u7b26\u4e32\u5f62\u5f0f\u5b58\u5728\u6587\u4ef6\u4e2d\u3002\n\n\u793a\u4f8b\uff1a\n\n```python\nfrom fanpy import *\n\nMY_FANFOU_CREDS = os.path.expanduser('~/.my_app_credentials')\nif not os.path.exists(MY_FANFOU_CREDS):\n oauth_dance('My App Name', CONSUMER_KEY, CONSUMER_SECRET, MY_FANFOU_CREDS)\n\noauth_token, oauth_token_secret = read_token_file(MY_FANFOU_CREDS)\n\nfanfou = Fanfou(auth=OAuth(\n oauth_token, oauth_token_secret, CONSUMER_KEY, CONSUMER_SECRET))\n\n# Now work with Fanfou\nfanfou.statuses.update(status='Hello, world!')\n```\n\n## \u5176\u4ed6\u996d\u53cb\u5236\u4f5c\u7684\u5de5\u5177\n\n\u7f51\u4e0a\u8fd8\u6709\u5f88\u591a\u4e0e `fanpy` \u9879\u76ee\u7c7b\u4f3c\u7684\u5de5\u5177\uff0c`fanpy` \u5728\u6539\u9020 [Python Twitter Tools](https://github.com/sixohsix/twitter) \u7684\u8fc7\u7a0b\u4ece\u4e2d\u83b7\u53d6\u4e86\u7075\u611f\uff0c\u5217\u4e8e\u4e0b\u65b9\u8868\u793a\u611f\u8c22\uff0c\u540c\u65f6\u4ee5\u4f9b\u5907\u7528\u53c2\u8003\uff1a\n\n- [fanfou](https://github.com/akgnah/fanfou.bot/blob/master/fanfou.py) \u996d\u5426 OAuth (XAuth) \u6a21\u5757\n- [\u996d\u76d2](http://www.aoisnow.net/blog/fanhe) Windows \u4e0b\u7684\u996d\u5426\u7528\u6237\u6570\u636e\u7ba1\u7406\u5de5\u5177\u96c6\n- [pyfan](https://github.com/raptorz/pyfan) Fanfou client for python\n- [pyfanfou](https://github.com/mcxiaoke/pyfanfou) \u996d\u5426\u6570\u636e\u5907\u4efd\u548c\u5bfc\u51fa\u5de5\u5177\n- [fanfou-backup](https://github.com/heedless/fanfou-backup) \u996d\u5426\u6d88\u606f\u5907\u4efd\u5de5\u5177\n- [Treeholes](https://github.com/fanzeyi/Treeholes) An anonymous bot for Fanfou\n\n## License\n\nMIT", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mookrs/fanpy", "keywords": "fanfou,cli", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "fanpy", "package_url": "https://pypi.org/project/fanpy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/fanpy/", "project_urls": { "Homepage": "https://github.com/mookrs/fanpy" }, "release_url": "https://pypi.org/project/fanpy/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "An API and cli toolset for Fanfou.com", "version": "0.2.0" }, "last_serial": 2620547, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "8baf1b2a6f933939294df34c25f5c9a7", "sha256": "e912e1c6b20426a10279d21648be690a7f5d29d27b77a482e7bb9706b39e72ba" }, "downloads": -1, "filename": "fanpy-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8baf1b2a6f933939294df34c25f5c9a7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 28324, "upload_time": "2017-02-05T14:40:33", "url": "https://files.pythonhosted.org/packages/1e/d3/7d76b651d8b8ca485c90f4e034e0e1e6e32859413e1021bef09d14260654/fanpy-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ecc46bbc23074d4a3c012801aa2dfd6b", "sha256": "3a984143cb6469423d032449171b599203f871a59f093767fd86434d76fe5a5c" }, "downloads": -1, "filename": "fanpy-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ecc46bbc23074d4a3c012801aa2dfd6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20233, "upload_time": "2017-02-05T14:32:31", "url": "https://files.pythonhosted.org/packages/e5/1c/94fc0436cee85543a75cdf655fd1b505d61312d362959ae85565aac4cb9a/fanpy-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8baf1b2a6f933939294df34c25f5c9a7", "sha256": "e912e1c6b20426a10279d21648be690a7f5d29d27b77a482e7bb9706b39e72ba" }, "downloads": -1, "filename": "fanpy-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8baf1b2a6f933939294df34c25f5c9a7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 28324, "upload_time": "2017-02-05T14:40:33", "url": "https://files.pythonhosted.org/packages/1e/d3/7d76b651d8b8ca485c90f4e034e0e1e6e32859413e1021bef09d14260654/fanpy-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ecc46bbc23074d4a3c012801aa2dfd6b", "sha256": "3a984143cb6469423d032449171b599203f871a59f093767fd86434d76fe5a5c" }, "downloads": -1, "filename": "fanpy-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ecc46bbc23074d4a3c012801aa2dfd6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20233, "upload_time": "2017-02-05T14:32:31", "url": "https://files.pythonhosted.org/packages/e5/1c/94fc0436cee85543a75cdf655fd1b505d61312d362959ae85565aac4cb9a/fanpy-0.2.0.tar.gz" } ] }