PRAW/PYTHON,如何修复 .comments 函数中的 400 HTTP 响应?

PRAW/PYTHON, how to fix 400 HTTP Response in .comments function?

我正在尝试抓取 reddit 评论,但我无法向 reddit 发送请求。似乎在我的简短脚本的某个地方出现了一些错误的语法。有人能发现吗?

我试过使用和不使用 redirect_uri。在我的 Reddit 应用程序页面下,它说我的应用程序已获得授权。我还尝试将 user_agent 名称更改为我的用户名以外的其他名称,但仍然无效。我不确定要提供哪些其他信息。

import praw #Python Reddit API Wrapper

reddit = praw.Reddit(client_id='ID', \ #the personal number
                     client_secret='SECRET', \ #the secret number
                     user_agent='Username', \ #Identical to username
                     username='Username', \ #Identical to user_agent
                     password='PW', \ 
                     redirect_uri='http://localhost:8080')

#confirm connection:
print(reddit.user.me()) # this works and returns my Username

submission = reddit.submission("https://www.reddit.com/r/funny/comments/ch6oz0/amasian/")
submission.comments #this fails and returns:

  File "/lib/python3.6/site-packages/prawcore/sessions.py", line 130, in _request_with_retries
    raise self.STATUS_EXCEPTIONS[response.status_code](response)

BadRequest: received 400 HTTP response
help(reddit.submission)
Help on method submission in module praw.reddit:

submission(id=None, url=None) method of praw.reddit.Reddit instance
    Return a lazy instance of :class:`~.Submission`.

    :param id: A reddit base36 submission ID, e.g., ``2gmzqe``.
    :param url: A URL supported by
        :meth:`~praw.models.Submission.id_from_url`.`.

    Either ``id`` or ``url`` can be provided, but not both.

submission() 认为我输入的是 ID,因为我没有指定 url=''。

伙计们,不能太悲伤了,案子结了。