开发者

Foursquare Oauth with Python

开发者 https://www.devze.com 2023-01-08 06:21 出处:网络
I\'m trying to figure out Fours开发者_StackOverflow社区quare\'s OAuth so I can have a user sign into my app. So far I found this tutorial: http://pkarl.com/articles/connect-foursquare-api-oauth-python

I'm trying to figure out Fours开发者_StackOverflow社区quare's OAuth so I can have a user sign into my app. So far I found this tutorial: http://pkarl.com/articles/connect-foursquare-api-oauth-python/

Unfortunately, it doesn't work. I got the same error message the commenters were getting. If anyone knows what the tutorial did wrong or knows another way of authenticating a foursquare account with OAuth, I would love to hear!


Okay, I figured it out. Instead, I used this: http://github.com/wiseman/foursquare-python/tree/16138f7be20ec9ab6b58315dad9ee9765e73bb84

I already had the user_key and user_secret on hand, so it was just a matter of a few lines:

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()


I've created a simple example on how to do this when using Google App Engine. (https://github.com/muanis/foursquare-oauth-bootstrap) basically you need Google oAuth2 Client (http://code.google.com/p/google-api-python-client/) and httplib2 (http://code.google.com/p/httplib2/)

0

精彩评论

暂无评论...
验证码 换一张
取 消