【问题标题】:Using reddit api incorrectly?错误地使用 reddit api?
【发布时间】:2016-01-09 02:19:26
【问题描述】:
import requests

def username_avail(user):
    payload = {'user': 'k9thebeast'}
    r = requests.post("https://reddit.com/api/username_availible",   data=payload)
    print(r.text)

username_avail("k9thebeast")

我想检查我的用户名是否可用。我不断收到一个巨大的 html 页面返回。我正在寻找 JSON 响应。有什么想法吗?

【问题讨论】:

    标签: python api reddit


    【解决方案1】:

    尝试 GET 而不是 POST。

    也尝试正确拼写username_available ;-)

    https://www.reddit.com/dev/api#GET_api_username_available

    【讨论】:

    • 谢谢兄弟。错别字不好
    猜你喜欢
    • 2017-07-20
    • 2012-07-03
    • 2018-10-25
    • 2013-07-04
    • 2018-07-29
    • 1970-01-01
    • 2014-12-11
    • 2012-03-19
    • 2012-02-16
    相关资源
    最近更新 更多