{
"info": {
"author": "Winton Wang",
"author_email": "365504029@qq.com",
"bugtrack_url": null,
"classifiers": [
"Development Status :: 5 - Production/Stable",
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6"
],
"description": "# Weibopy \n\nWeibopy is a weibo python3 sdk, support Python3 with requests packages.\n\n\n[](https://travis-ci.org/nooperpudd/weibopy)\n[](https://codecov.io/gh/nooperpudd/weibopy)\n[](https://pypi.python.org/pypi/weibopy)\n[](https://pypi.python.org/pypi/weibopy)\n[](https://pypi.python.org/pypi/weibopy)\n\n[Weibo API doc](http://open.weibo.com/wiki/SDK)\n\n## Install\nNormal support Python3 version.\n\n pip3 install weibopy\n \n## Prepare\n\n1. First, need to register the weibo developer account, and build an app based \n [Weibo Platform] (http://open.weibo.com/index.php).\n2. Now we can get the `App Key` and `App Secret` in the weibo app info page.\n3. Set the callback url in the weibo app settings.\n4. Token authorization. \n\n\n```Python\n\nfrom weibopy import WeiboOauth2\n\nclient_id=\"xxx\",\nclient_secret=\"xxx\"\nredirect_url=\"http://\"\nclient = WeiboOauth2(client_id,client_secret,redirect_url)\n\nauthorize_url = client.authorize_url\n\n# 'https://api.weibo.com/oauth2/authorize?redirect_uri=http%3A%2F%2F127.0.0.1%2Fcallback&client_id=123456'\n```\n\n5. Open the authorize url in the browser, and send the code to get access token.\n\n```Python\n\nclient.auth_access(auth_code)\n\n{\n \"access_token\": \"ACCESS_TOKEN\",\n \"expires_in\": 1234,\n \"remind_in\":\"798114\",\n \"uid\":\"12341234\"\n}\n\n\n```\n\n6. If the token is expired, we need to use `refresh_token` to get the access token.\n \n**Note**: This refresh only provide official mobile app. \n\n## Usage\n\nIf we got the the `access_token`, now we can call api functions.\n\nAll the modules separated as the parts of the weibo api client to handler data .\n\n WeiboOauth2 # weibo Oauth2 authentication\n WeiboClient # weibo Client API \n WeiboAPIError # weibo api error\n WeiboOauth2Error # weibo oath2 error\n \nIf we want to get the public tweets in recently hours.\n\n```python\nfrom weibopy import WeiboClient\n\naccess_token = \"\"\nclient = WeiboClient(access_token)\n\n\nresult =client.get(suffix=\"statuses/public_timeline.json\")\n\n\n{\n \"statuses\": [{\n \"created_at\": \"Tue May 31 17:46:55 +0800 2011\",\n \"id\": 11488058246,\n \"text\": \"\u6c42\u5173\u6ce8\u3002\",\n \"source\": \"\u65b0\u6d6a\u5fae\u535a\",\n \"favorited\": False,\n \"truncated\": False,\n \"in_reply_to_status_id\": \"\",\n \"in_reply_to_user_id\": \"\",\n \"in_reply_to_screen_name\": \"\",\n \"geo\": None,\n \"mid\": \"5612814510546515491\",\n \"reposts_count\": 8,\n \"comments_count\": 9,\n \"annotations\": [],\n \"user\": {\n \"id\": 1404376560,\n \"screen_name\": \"zaku\",\n \"name\": \"zaku\",\n \"province\": \"11\",\n \"city\": \"5\",\n \"location\": \"\u5317\u4eac \u671d\u9633\u533a\",\n \"description\": \"\u4eba\u751f\u4e94\u5341\u5e74\uff0c\u4e43\u5982\u68a6\u5982\u5e7b\uff1b\u6709\u751f\u65af\u6709\u6b7b\uff0c\u58ee\u58eb\u590d\u4f55\u61be\u3002\",\n \"url\": \"http://blog.sina.com.cn/zaku\",\n \"profile_image_url\": \"http://tp1.sinaimg.cn/1404376560/50/0/1\",\n \"domain\": \"zaku\",\n \"gender\": \"m\",\n \"followers_count\": 1204,\n \"friends_count\": 447,\n \"statuses_count\": 2908,\n \"favourites_count\": 0,\n \"created_at\": \"Fri Aug 28 00:00:00 +0800 2009\",\n \"following\": False,\n \"allow_all_act_msg\": False,\n \"remark\": \"\",\n \"geo_enabled\": False,\n \"verified\": False,\n \"allow_all_comment\": False,\n \"avatar_large\": \"http://tp1.sinaimg.cn/1404376560/180/0/1\",\n \"verified_reason\": \"\",\n \"follow_me\": False,\n \"online_status\": 0,\n \"bi_followers_count\": 215\n }\n },\n \n ],\n \"previous_cursor\": 0,\n \"next_cursor\": 11488013766,\n \"total_number\": 81655\n }\n```\n\nHow to post a tweet with a picture?\n\n```python\n\nfrom weibopy import WeiboClient\n\naccess_token = \"\"\nclient = WeiboClient(access_token)\n\nfiles = {'pic': open('a.png', 'rb')}\nclient.post(\"statuses/upload.json\", data={\"status\":\"nihao\"}, files=files)\n```\n\nresult:\n\n```\n \u00a0 \u00a0 {\n \u00a0 \u00a0 'biz_feature': 0,\n 'bmiddle_pic': 'http://wx1.sinaimg.cn/bmiddle/70669a5dly1fescai5ggkj20gf0feq7e.jpg',\n 'comments_count': 0,\n 'created_at': 'Wed Apr 19 22:06:20 +0800 2017',\n 'darwin_tags': [],\n 'favorited': False,\n 'geo': None,\n 'gif_ids': None,\n 'hasActionTypeCard': 0,\n 'hot_weibo_tags': [],\n 'id': 4098369015668443,\n 'idstr': '4098369015668443',\n 'in_reply_to_screen_name': '',\n 'in_reply_to_status_id': '',\n 'in_reply_to_user_id': '',\n 'isLongText': False,\n 'is_show_bulletin': 2,\n 'mid': '4098369015668443',\n 'mlevel': 0,\n 'original_pic': 'http://wx1.sinaimg.cn/large/70669a5dly1fescai5ggkj20gf0feq7e.jpg',\n 'pic_urls': [{'thumbnail_pic': 'http://wx1.sinaimg.cn/thumbnail/70669a5dly1fescai5ggkj20gf0feq7e.jpg'}],\n 'positive_recom_flag': 0,\n 'reposts_count': 0,\n 'source': '\u672a\u901a\u8fc7\u5ba1\u6838\u5e94\u7528',\n 'source_allowclick': 0,\n 'source_type': 1,\n 'text': 'hhha \\u200b',\n 'textLength': 4,\n 'text_tag_tips': [],\n 'thumbnail_pic': 'http://wx1.sinaimg.cn/thumbnail/70669a5dly1fescai5ggkj20gf0feq7e.jpg',\n 'truncated': False,\n 'user': {'allow_all_act_msg': False,\n 'allow_all_comment': True,\n 'avatar_hd': 'http://tva4.sinaimg.cn/crop.320.120.960.960.1024/70669a5djw1eanuztfpewj218g0xcn9c.jpg',\n 'avatar_large': 'http://tva4.sinaimg.cn/crop.320.120.960.960.180/70669a5djw1eanuztfpewj218g0xcn9c.jpg',\n 'bi_followers_count': 9,\n 'block_app': 0,\n 'block_word': 0,\n 'city': '2',\n 'class': 1,\n 'created_at': 'Tue Dec 07 21:44:06 +0800 2010',\n 'credit_score': 80,\n 'description': '',\n 'domain': 'nooper',\n 'favourites_count': 3,\n 'follow_me': False,\n 'followers_count': 48,\n 'following': False,\n 'friends_count': 140,\n 'gender': 'm',\n 'geo_enabled': True,\n 'id': 1885772381,\n 'idstr': '1885772381',\n 'insecurity': {'sexual_content': False},\n 'lang': 'zh-cn',\n 'location': '\u5317\u4eac \u897f\u57ce\u533a',\n 'mbrank': 0,\n 'mbtype': 0,\n 'name': '\u738b\u5c0f\u5c0f\u5c0f\u5c0f\u5c0f\u83ab',\n 'online_status': 0,\n 'pagefriends_count': 0,\n 'profile_image_url': 'http://tva4.sinaimg.cn/crop.320.120.960.960.50/70669a5djw1eanuztfpewj218g0xcn9c.jpg',\n 'profile_url': 'nooper',\n 'province': '11',\n 'ptype': 0,\n 'remark': '',\n 'screen_name': '\u738b\u5c0f\u5c0f\u5c0f\u5c0f\u5c0f\u83ab',\n 'star': 0,\n 'statuses_count': 168,\n 'urank': 13,\n 'url': '',\n 'user_ability': 0,\n 'verified': False,\n 'verified_reason': '',\n 'verified_reason_url': '',\n 'verified_source': '',\n 'verified_source_url': '',\n 'verified_trade': '',\n 'verified_type': -1,\n 'weihao': ''},\n 'userType': 590081,\n 'visible': {'list_id': 0, 'type': 0}}\n \u00a0 \u00a0 \n```\n\n## Contact\n\nIf you have any question about the weibo API, contact 365504029@qq.com",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/nooperpudd/weibopy",
"keywords": "",
"license": "BSD",
"maintainer": "",
"maintainer_email": "",
"name": "weibopy",
"package_url": "https://pypi.org/project/weibopy/",
"platform": "",
"project_url": "https://pypi.org/project/weibopy/",
"project_urls": {
"Homepage": "https://github.com/nooperpudd/weibopy"
},
"release_url": "https://pypi.org/project/weibopy/0.1.2/",
"requires_dist": null,
"requires_python": "",
"summary": "Sina Weibo API SDK",
"version": "0.1.2"
},
"last_serial": 3779588,
"releases": {
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "29836f21a14f69b47ccb32ef3889196c",
"sha256": "a1303b3fab53fda37c979023a852620792350af294cc1ca0eb24ba4f2806b32f"
},
"downloads": -1,
"filename": "weibopy-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "29836f21a14f69b47ccb32ef3889196c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17132,
"upload_time": "2017-04-24T06:33:09",
"url": "https://files.pythonhosted.org/packages/0b/6c/32c887fd3f0914c26ab9170832c84814118e53b643f97ef80e2e0c3d7c8f/weibopy-0.1.0.tar.gz"
}
],
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "9f1559787c1701b56681cbc3aca5523e",
"sha256": "30cb1c01c20259a6c74048437dc648427e45af691753e4ab9d2b9e112fe12f55"
},
"downloads": -1,
"filename": "weibopy-0.1.1-py3.5.egg",
"has_sig": false,
"md5_digest": "9f1559787c1701b56681cbc3aca5523e",
"packagetype": "bdist_egg",
"python_version": "3.5",
"requires_python": null,
"size": 26354,
"upload_time": "2017-08-14T02:58:28",
"url": "https://files.pythonhosted.org/packages/41/93/470ef83861b72e11157f3ef17bd024bd58c9b42259fdfd52177311605c44/weibopy-0.1.1-py3.5.egg"
},
{
"comment_text": "",
"digests": {
"md5": "800c00f0dea58465e7a90c2b8ef645c1",
"sha256": "91828405fe85ce56f823bd6d24dfcff03c05bd999749bc0d1d311d6f6110669a"
},
"downloads": -1,
"filename": "weibopy-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "800c00f0dea58465e7a90c2b8ef645c1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17078,
"upload_time": "2017-08-14T03:06:34",
"url": "https://files.pythonhosted.org/packages/c7/df/993fad5a271e04f28a6b396fe9d6969b6f4c8db80123733b0ab6ec25f456/weibopy-0.1.1.tar.gz"
}
],
"0.1.2": [
{
"comment_text": "",
"digests": {
"md5": "e530175d88381c6e8974af562f240a7d",
"sha256": "33ec66a424d3ec3d7c5f75d04febe461f1d1ae01c837a4de6c0a0e4052f621de"
},
"downloads": -1,
"filename": "weibopy-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "e530175d88381c6e8974af562f240a7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15454,
"upload_time": "2018-04-19T06:32:17",
"url": "https://files.pythonhosted.org/packages/fa/4e/43ec3b51d53c5a5f62d8010e672bce2555ba5ae72bc93f6eb1a05e43b5bd/weibopy-0.1.2.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "e530175d88381c6e8974af562f240a7d",
"sha256": "33ec66a424d3ec3d7c5f75d04febe461f1d1ae01c837a4de6c0a0e4052f621de"
},
"downloads": -1,
"filename": "weibopy-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "e530175d88381c6e8974af562f240a7d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 15454,
"upload_time": "2018-04-19T06:32:17",
"url": "https://files.pythonhosted.org/packages/fa/4e/43ec3b51d53c5a5f62d8010e672bce2555ba5ae72bc93f6eb1a05e43b5bd/weibopy-0.1.2.tar.gz"
}
]
}