{ "info": { "author": "Tom Li", "author_email": "biergaizi@member.fsf.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3 :: Only", "Topic :: Internet", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "rpweibo\n=======\n\ncURL + Python Weibo Wrapper.\n\n\n## Installing\n\n```bash\nsudo python3 setup.py install\n```\n\n## Usage\n\n### Initialize\n\n```python\nimport rpweibo\n\nexample_app = rpweibo.Application(APP_KEY, APP_SECRET, REDIRECT_URI)\nweibo = rpweibo.Weibo(example_app)\n```\n\n### Authorize\n\n#### with Username and Password\n\n```python\nauthenticator = rpweibo.UserPassAutheticator(USERNAME, PASSWORD)\ntry:\n weibo.auth(authenticator)\nexcept rpweibo.AuthorizeFailed:\n print(\"Invalid username or password!\")\n```\n\n#### with Existing Access Token\n\n```python\nauthenticator = rpweibo.AccessTokenAuthenticator(ACCESS_TOKEN)\nweibo.auth(authenticator)\n```\n\n### Using API\n\n#### Styles\n\n##### Procedural Style\n\n```python\ntweets = weibo.get(\"statuses/user_timeline\")[\"statuses\"]\nfor tweet in tweets:\n print(tweet[\"text\"])\n\nweibo.post(\"statuses/update\", status=\"Hello, world!\")\n```\n\n##### Object Style\n\n```python\ntweets = weibo.api(\"statuses/user_timeline\").get().statuses\nfor tweet in tweets:\n print(tweet.text)\n\nweibo.api(\"statuses/update\").post(status=\"Hello, world!\")\n```\n\n### Error Handling\n\n```python\ntry:\n tweets = weibo.api(\"statuses/user_timeline\").get().statuses\nexcept rpweibo.RemoteError:\n # handle API errors likely cause by remote server\n print(\"Something wrong with the server\")\nexcept rpweibo.CallerError:\n # handle API errors likely cause by the client\n print(\"You shouldn't use the API in this way\")\nexcept rpweibo.ResultCorrupted:\n print(\"Request the API successfully, but got the corrupted result\")\nexcept rpweibo.NetworkError:\n print(\"Somethings wrong with your network\")\nexcept rpweibo.APIError as e:\n # Handle all API errors, including RemoteError and CallerError.\n # NOTE: we handle both two type of API errors already, never reach here\n print(\"%d - %s\" % (e.error_code, e.error_message))\n```", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/WeCase/rpweibo", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/WeCase/rpweibo", "keywords": null, "license": "LGPLv3+", "maintainer": null, "maintainer_email": null, "name": "rpweibo", "package_url": "https://pypi.org/project/rpweibo/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rpweibo/", "project_urls": { "Download": "https://github.com/WeCase/rpweibo", "Homepage": "https://github.com/WeCase/rpweibo" }, "release_url": "https://pypi.org/project/rpweibo/0.2.2/", "requires_dist": null, "requires_python": null, "summary": "cURL + Python Weibo Wrapper", "version": "0.2.2" }, "last_serial": 1666886, "releases": { "0.2.1": [], "0.2.2": [ { "comment_text": "", "digests": { "md5": "84821d224e2ea4423acc2e37bcdd5888", "sha256": "71efc915cdc8a0c28a8cea548987edba0dcb1be4a6dd8f0e115469105ad672cd" }, "downloads": -1, "filename": "rpweibo-0.2.2.tar.gz", "has_sig": false, "md5_digest": "84821d224e2ea4423acc2e37bcdd5888", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6325, "upload_time": "2015-08-06T13:29:50", "url": "https://files.pythonhosted.org/packages/b2/ea/f24d3d115c7ff009080a10d6df28e8ee7844362369de818999c986d19854/rpweibo-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "84821d224e2ea4423acc2e37bcdd5888", "sha256": "71efc915cdc8a0c28a8cea548987edba0dcb1be4a6dd8f0e115469105ad672cd" }, "downloads": -1, "filename": "rpweibo-0.2.2.tar.gz", "has_sig": false, "md5_digest": "84821d224e2ea4423acc2e37bcdd5888", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6325, "upload_time": "2015-08-06T13:29:50", "url": "https://files.pythonhosted.org/packages/b2/ea/f24d3d115c7ff009080a10d6df28e8ee7844362369de818999c986d19854/rpweibo-0.2.2.tar.gz" } ] }