0
我正在嘗試使用github oauth。 I'n使用的urllib和urllib2的和有這樣的代碼:如何通過Django發送GET請求
def github_login(request):
post_data = [('client_id','****'),('redirect_uri','http://localhost:8000/callback')]
result = urllib2.urlopen('https://github.com/login/oauth/authorize', urllib.urlencode(post_data))
content = result.read()
和發送的查詢後,我有httperror 403.我已經配置在settings.py
PLE ase顯示你的完整代碼。包括settings.py。你如何在這裏使用'settings.py' – nish
好吧,錯誤403不是從Django的,因爲我明白你的desription。它來自github。你的查詢出錯了。 ANYWAY for auth你可以使用這個應用程序:https://github.com/pennersr/django-allauth – Aldarund
問題已關閉。回答是,urllib2.urlopen發送POST請求,如果給它兩個參數。右:urllib2.urlopen('ex.ru?%s'%urllib.urlencode(data)) – prozac631