2017-03-01 5 views
0

Praw 4.4.0を使用してPython 2.7仮想envでDjango 1.8 Webアプリケーションをローカルに構築しています。エラー:PYTHON DJANGO PRAW REDDIT-API

プロジェクトはdemonstrationと呼ばれ、アプリがapp

enter image description here

ATM、

enter image description here

呼ばれたに行くとき、これは結果の一部です:http://127.0.0.1:8000/app/profile/

app/views.pyには次のコードがありますプロファイルの場合:

# views.py 

from django.shortcuts import render, HttpResponse 
import requests 
import praw 


# Create your views here. 
    def profile(request): 
     reddit = praw.Reddit(client_id='client_id', 
         client_secret='client_secret', 
         username='username', 
         password='password', 
         user_agent='user_agent') 
     # assume you have a Reddit instance bound to variable `reddit` 
     subreddit = reddit.subreddit('redditdev') 

     print(subreddit.display_name) # Output: redditdev 
     print(subreddit.title) # Output: reddit Development 
     print(subreddit.description) # Output: A subreddit for discussion of ... 

2番目の画像からわかるように、サブディレクトリの名前が表示されます。 グレート

subreddit = reddit.subreddit('redditdev') 

print(subreddit.display_name) # Output: redditdev 

それが実際のRedditに移動し、データを吸うしようとしたら、これが結果です:

print(subreddit.title) # Output: reddit Development 
print(subreddit.description) # Output: A subreddit for discussion of ... 
コードで書かれていたので、それを見、Redditにから拾っていない

enter image description here

Debug mode = Trueを使用して

[01/Mar/2017 14:50:02]"GET /app/profile/ HTTP/1.1" 500 93288

、1ページに次のように表示することができます3210

問題:何とか、Redditは自分のログインを好まないです。

私はどのようにしてデータを印刷できますか?

どうすればよいですか?

ご支援

ありがとう\\\\\固定

http://praw.readthedocs.io/en/latest/getting_started/quick_start.html

https://pypi.python.org/pypi/praw

答えて

0

////////いくつかの有用なリンクを。 問題だった:

username='username', 
password='password', 

それを削除してから作業を始めました。

enter image description here