## 关于
Zhihu-API 的初衷是希望提供一套简洁、优雅的、Pythonic的API接口,面向的用户是对知乎数据有兴趣的群体,它可以用在数据分析、数据挖掘、增长黑客、以及希望通过程序自动完成知乎某个操作等应用场景。
注意:只支持Python3
## 安装
```python
pip install -U zhihu
# 或者安装最新包
pip install git+git://github.com/lzjun567/zhihu-api --upgrade
```
## 快速上手
```python
from zhihu import Zhihu
zhihu = Zhihu()
#获取用户基本信息
profile = zhihu.profile(user_slug="xiaoxiaodouzi")
print(profile)
>>>
{
'name': '我是x',
'headline': '程序员',
'gender': -1,
'user_type': 'people',
'is_advertiser': False,
'url_token': 'xiaoxiaodouzi',
'id': '1da75b85900e00adb072e91c56fd9149',
'is_org': False
}
# 发送私信
>>> zhihu.send_message(content="私信测试", user_slug="xiaoxiaodouzi")
<Response [200]>
# 关注用户
>>> zhihu.follow(user_slug="xiaoxiaodouzi")
{'follower_count': 12, 'followed': True}
# 取消关注
>>> zhihu.unfollow(user_slug="xiaoxiaodouzi")
{'follower_count': 11, 'followed': False}
>>> from zhihu import Answer
>>> answer = Answer(url="https://www.zhihu.com/question/62569341/answer/205327777")
# 赞同回答
>>> answer.vote_up()
{'voting': 1, 'voteup_count': 260}
# 反对
>>> answer.vote_down()
{'voting': -1, 'voteup_count': 259}
# 中立
>>> answer.vote_neutral()
{'voting': 0, 'voteup_count': 260}
# 感谢回答
>>> answer.thank()
{'is_thanked': True}
# 取消感谢
>>> answer.thank_cancel()
{'is_thanked': False}
```
## 贡献者
欢迎 PR, 所有贡献者都将出现在这里,排名不分先后
* [@BigBorg](https://github.com/BigBorg)
* [@xiaowenlong100](https://github.com/xiaowenlong100)
* [@chenghengchao](https://github.com/chenghengchao)
* [@MaxPoon](https://github.com/MaxPoon)
* [@Oopswc](https://github.com/Oopswc)
## 交流
群已经加不进,可以先加微信:lzjun567 拉你入群

Metadata
Release files for zhihu 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zhihu-0.2.6.tar.gz | 11.2 kB | Without provenance | Details for zhihu-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zhihu-0.2.6-py3.6.egg | Legacy Egg format | - | - | Details for zhihu-0.2.6-py3.6.egg |
Total release size: 51.4 kB
Release files / zhihu-0.2.6.tar.gz
| Download URL | zhihu-0.2.6.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2dd321b03b48fe3735c3ea03fd46384c0793ba57b0d057a5aded4c5f629c47f
|
|
BLAKE2b-256 checksum How to use checksums |
342eaa9edb82234f79f99666d70cd7369321223b3f2a4684c7927105e53b1876
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / zhihu-0.2.6-py3.6.egg
| Download URL | zhihu-0.2.6-py3.6.egg |
|---|---|
| Size | 40.2 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
a2f28f01ad8965e184f63a736b666d629004da43ce8318ab97f128870312c811
|
|
BLAKE2b-256 checksum How to use checksums |
12e43a31df621af4e0803f80460eb4ec7f6012f14fabbb1d5362f46789c352e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for zhihu 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.