Skip to main content

阿里通义千问逆向工程API

Project description

revTongYi

PyPi Downloads

阿里通义千问Python逆向API

pip install revTongYi --upgrade
  • 需要通义千问测试资格
  • 到通义千问对话页面,获取cookies,以key: value的dict形式提供给构造函数
  • 您也可以使用Cookies Editor插件(参考)获取cookies的json,并参考test.py中的代码处理cookies
import revTongYi

question = "人工智能将对人类社会发展产生什么影响?"

session = revTongYi.Session(
    cookies=<cookies_dict>,  # cookies的key: value形式,dict类型
    firstQuery=question
)

print(
    next(
        session.ask(  # ask方法实际上是一个迭代器,可以提供参数stream=True并换用for的方式迭代
            prompt=question
        )  # ask方法接收的详细参数请查看源码
    )
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

revtongyi-0.0.0.2.tar.gz (17.1 kB view hashes)

Uploaded Source

Built Distribution

revtongyi-0.0.0.2-py3-none-any.whl (15.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page