{"id":28523188,"url":"https://github.com/duoshuo/duoshuo-python-sdk","last_synced_at":"2025-07-06T05:32:28.014Z","repository":{"id":2688149,"uuid":"3680957","full_name":"duoshuo/duoshuo-python-sdk","owner":"duoshuo","description":"A Python library for using the duoshuo API","archived":false,"fork":false,"pushed_at":"2021-11-23T11:12:01.000Z","size":498,"stargazers_count":88,"open_issues_count":2,"forks_count":32,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-09T10:07:57.388Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://duoshuo.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duoshuo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-03-10T17:20:57.000Z","updated_at":"2025-02-15T22:18:40.000Z","dependencies_parsed_at":"2022-09-04T09:51:32.904Z","dependency_job_id":null,"html_url":"https://github.com/duoshuo/duoshuo-python-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/duoshuo/duoshuo-python-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duoshuo%2Fduoshuo-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duoshuo%2Fduoshuo-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duoshuo%2Fduoshuo-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duoshuo%2Fduoshuo-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duoshuo","download_url":"https://codeload.github.com/duoshuo/duoshuo-python-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duoshuo%2Fduoshuo-python-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263853369,"owners_count":23520129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-09T10:07:34.533Z","updated_at":"2025-07-06T05:32:28.009Z","avatar_url":"https://github.com/duoshuo.png","language":"Python","readme":"![Banner](https://raw.github.com/perchouli/img/master/banner-772x250.png)\n\n# Duoshuo Python SDK\n\n多说Python SDK支持用Python语言开发的网站，对其提供[多说]插件的支持。使用中遇到的问题请[到多说开发者中心提问](http://dev.duoshuo.com/threads/500c9c58a03193c12400000c \"多说开发者中心\") 。\n\n# Requirements\n\nPython 2.6+\n\nDjango 1.6+ (如果在Django中使用)\n\n# Install\n\n    python setup.py install\n\n# Index\n\n[Python Useage](#python-usage)\n\n[Django useage](#django-usage)\n\n\n# Python Usage\n\n作为Python models来使用\n\n### Core (__init__.py)\n\nsdk核心功能： 交换token，生成授权链接，调用api接口\n\n#### 实例化duoshuoAPI\n\n    from duoshuo import DuoshuoAPI\n\n    api = DuoshuoAPI(short_name=YOUR_DUOSHUO_SHORT_NAME, secret=YOUR_DUOSHUO_SECRET)\n\n    #例如要获取用户信息\n    api.users.profile(user_id=1)\n\n\n更多API可以查看[多说开发文档](http://dev.duoshuo.com/docs \"多说开发文档\") 。\n\n#### 交换token\n访问需要登录的接口时要先进行授权，采用OAuth2.0协议，Python SDK提供交换token的处理，实例化api后可以直接传入code来获取token：\n\n    code = request.GET.get('code') #获得GET参数(以Django为例)\n\n    token = api.get_token(code=code)\n\n\n# Django Usage\n\n作为Django app来使用\n\n#### 安装duoshuo插件\n\n    # settings.py\n    INSTALLED_APPS = (\n        ...\n        'duoshuo',\n    )\n\n    DUOSHUO_SECRET = '你的多说secret，在多说管理后台 - 设置 - 密钥'\n    DUOSHUO_SHORT_NAME = '你的多说short name，比如你注册了example.duoshuo.com，short name就是example'\n\n#### 显示多说评论框\n\n    {% load duoshuo_tags %}\n\n    {% duoshuo_comments %}\n\n    #给多说评论框传递其他short name\n    {% duoshuo_comments '其他short name' %}\n\n","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduoshuo%2Fduoshuo-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduoshuo%2Fduoshuo-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduoshuo%2Fduoshuo-python-sdk/lists"}