github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

wiseman / foursquare-python

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 12
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (0)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (0)
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

Python module to interface with the foursquare API — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Fixed bug where consumer_secret wasn't being set.  Reported by Mike 
Cardosa. 
wiseman (author)
Tue Jan 26 08:02:03 -0800 2010
commit  16138f7be20ec9ab6b58315dad9ee9765e73bb84
tree    fd18f6a564ee6ec12d64021542f4750f532d7eea
parent  232dda7bcd0de9a15dc9bb9b6565245dcb840ccc
foursquare-python /
name age
history
message
file .gitignore Fri Nov 27 10:32:04 -0800 2009 Ignore *.pyc, *~. [wiseman]
file LICENSE.txt Thu Nov 26 12:52:20 -0800 2009 Added license. [wiseman]
file README.rst Thu Dec 17 21:08:23 -0800 2009 Brought up to date with the v1 API as of 2009-1... [wiseman]
file foursquare.py Tue Jan 26 08:02:03 -0800 2010 Fixed bug where consumer_secret wasn't being se... [wiseman]
directory tests/ Tue Dec 08 04:04:17 -0800 2009 use getpass() for dealing with passwords [harrisony]
README.rst
Copyright 2009 John Wiseman
Covered by the MIT License, see LICENSE.txt.

foursquare

This Python module lets you access the foursquare API. It supports unauthenticated access, basic HTTP authentication, and OAuth authorization.

It supports all the v1 foursquare API methods as of 2009-12-17.

This module requires Leah Culver's oauth module, oauth.py.

API method names are the same in Python, except for methods like "friend/requests", which are translated to names like "friend_requests" in Python.

All arguments are keyword arguments, though required arguments come first and are in the order listed by the API documentation.

All methods return the Python equivalent of the JSON response returned by the corresponding API method, if there is a response.

Examples

No authentication:

>>> import foursquare
>>> fs = foursquare.Foursquare()
>>> fs.cities()
{'cities': [{'geolat': 52.378900000000002, 'name': 'Amsterdam', ...}]}

Basic HTTP authentication:

>>> import foursquare
>>> fs = foursquare.Foursquare(foursquare.BasicCredentials(username, password))
>>> fs.switchcity(23)
{'data': {'status': '1', 'message': 'City switched successfully'}}
>>> fs.switchcity(34)
{'data': {'status': '1', 'message': 'City switched successfully'}}
>>> fs.user()
{'user': {'city': {'geolat': 34.0443, 'name': 'Los Angeles', ...}}}

OAuth:

>>> import foursquare
>>> credentials = foursquare.OAuthCredentials(oauth_key, oauth_secret)
>>> fs = foursquare.Foursquare(credentials)
>>> app_token = fs.request_token()
>>> auth_url = fs.authorize(app_token)
>>> # Go to auth_url and authorize, then continue.
>>> user_token = fs.access_token(app_token)
>>> credentials.set_access_token(user_token)
>>> fs.user()
{'user': {'city': {'geolat': 34.0443, 'name': 'Los Angeles', ...}}}
Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server