我想弄明白Foursquare的OAuth,所以我可以讓用戶登錄到我的應用程序。到目前爲止,我發現本教程:http://pkarl.com/articles/connect-foursquare-api-oauth-python/與Python Python Foursquare Oauth
不幸的是,它不起作用。我收到了評論者收到的同樣的錯誤信息。如果有人知道該教程做了什麼錯誤或知道另一種使用OAuth驗證foursquare帳戶的方式,我很樂意聽到!
我想弄明白Foursquare的OAuth,所以我可以讓用戶登錄到我的應用程序。到目前爲止,我發現本教程:http://pkarl.com/articles/connect-foursquare-api-oauth-python/與Python Python Foursquare Oauth
不幸的是,它不起作用。我收到了評論者收到的同樣的錯誤信息。如果有人知道該教程做了什麼錯誤或知道另一種使用OAuth驗證foursquare帳戶的方式,我很樂意聽到!
好的,我想通了。相反,我用這個:http://github.com/wiseman/foursquare-python/tree/16138f7be20ec9ab6b58315dad9ee9765e73bb84
我已經手頭上user_key和user_secret,所以這只是一個幾行件事:
import foursquare
import oauth
credentials = foursquare.OAuthCredentials(consumer_key, consumer_secret)
fs = foursquare.Foursquare(credentials)
user_token = oauth.OAuthToken(user_key, user_secret)
credentials.set_access_token(user_token)
print fs.user()
我創建了關於如何做一個簡單的例子這在使用Google App Engine時是如此。 (https://github.com/muanis/foursquare-oauth-bootstrap)基本上你需要Google oAuth2客戶端(http://code.google.com/p/google-api-python-client/)和httplib2(http: //code.google.com/p/httplib2/)