Praw 4.4.0을 사용하여 Python 2.7 가상 환경에서 Django 1.8 웹 응용 프로그램을 로컬로 빌드합니다. http://127.0.0.1:8000/app/profile/오류 : PYTHON DJANGO PRAW REDDIT-API
:
이 프로젝트는
이 결과의 일부입니다
가 갈 때,demonstration
을 불러
app
현금 지급기라는 응용 프로그램을 가지고있다 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 ...
두 번째 이미지에서 알 수 있듯이 하위 제목의 이름이 인쇄됩니다. 위대한.
음,별로 좋지 않습니다. 코드로 작성된, 그래서 레딧에서 따기 아니에요은 다음을 참조하십시오
print(subreddit.title) # Output: reddit Development
print(subreddit.description) # Output: A subreddit for discussion of ...
:
subreddit = reddit.subreddit('redditdev')
print(subreddit.display_name) # Output: redditdev
실제로 레딧로 이동하여 데이터를 빨아하려고하면,이 결과
:Debug mode = True
를 사용
[01/Mar/2017 14:50:02]"GET /app/profile/ HTTP/1.1" 500 93288
, 하나는 페이지에서 다음을 볼 수 있습니다3210
문제 : 어떻게 든 Reddit은 (는) 내 로그인을 좋아하지 않습니다.
어떻게 나를 좋아해서 데이터를 인쇄 할 수 있습니까?
더 잘할 수있는 방법은 무엇입니까?
는 지원
주셔서 감사합니다 \\\\\ 일부 유용한 링크를 고정
http://praw.readthedocs.io/en/latest/getting_started/quick_start.html
https://pypi.python.org/pypi/praw