2016-05-16 16 views
1

私はpythonを使ってRedditアカウントにログインしようとしています。Python PRAW - ログインできません、RedirectException

import time 
import praw 

r = praw.Reddit(user_agent='Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0') 
r.login('user', 'pass') 

これは私が取得していますエラーです:

Traceback (most recent call last): 
    File "/home/workspace/Reddit/logintest.py", line 5, in <module> 
    r.login('user', 'pass') 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/__init__.py", line 1334, in login 
    self.user = self.get_redditor(user) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/__init__.py", line 949, in get_redditor 
    return objects.Redditor(self, user_name, *args, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/objects.py", line 746, in __init__ 
    fetch, info_url) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/objects.py", line 73, in __init__ 
    self.has_fetched = self._populate(json_dict, fetch) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/objects.py", line 133, in _populate 
    json_dict = self._get_json_dict() if fetch else {} 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/objects.py", line 126, in _get_json_dict 
    as_objects=False) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/decorators.py", line 163, in wrapped 
    return_value = function(reddit_session, *args, **kwargs) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/__init__.py", line 561, in request_json 
    retry_on_error=retry_on_error) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/__init__.py", line 402, in _request 
    response = handle_redirect() 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/__init__.py", line 376, in handle_redirect 
    url = _raise_redirect_exceptions(response) 
    File "/usr/local/lib/python2.7/dist-packages/praw-2.1.21-py2.7.egg/praw/internal.py", line 164, in _raise_redirect_exceptions 
    raise RedirectException(response.url, new_url) 
praw.errors.RedirectException: Unexpected redirect from http://www.reddit.com/user/user/about/.json to https://www.reddit.com/user/user/about/.json 

私はこれをGoogleで検索してきたし、それについて何かを見つけることができません。

答えて

0

PRAWの私のバージョンが古くなっていたことが判明し、更新する必要がありました。 pip install praw --updatepip install prawは実際にあなたのバージョンを更新しないためです。

関連する問題