Science Score: 10.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
○codemeta.json file
-
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
2 of 31 committers (6.5%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.6%) to scientific vocabulary
Repository
The Foursquare API client for Python
Basic Info
- Host: GitHub
- Owner: mLewisLogic
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://pypi.python.org/pypi/foursquare/
- Size: 245 KB
Statistics
- Stars: 402
- Watchers: 20
- Forks: 108
- Open Issues: 2
- Releases: 0
Metadata Files
README.md
foursquare
Python client for the foursquare API.
Philosophy:
- Map foursquare's endpoints one-to-one
- Clean, simple, Pythonic calls
- Only handle raw data, you define your own models
Features:
- Python 2+3 compatibility (via @youngrok)
- OAuth dance
- Automatic retries
- Full endpoint coverage (non-merchant)
- Full test coverage
- Useful exception classes
- Multi support (via @benneic)
Dependencies:
- requests
Installation
pip install foursquare
Usage
Authentication
# Construct the client object
client = foursquare.Foursquare(client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET', redirect_uri='http://fondu.com/oauth/authorize')
# Build the authorization url for your app
auth_uri = client.oauth.auth_url()
Redirect your user to the address auth_uri and let them authorize your app. They will then be redirected to your redirect_uri, with a query parameter of code=XXCODERETURNEDINREDIRECTXX. In your webserver, parse out the code value, and use it to call client.oauth.gettoken()
# Interrogate foursquare's servers to get the user's access_token
access_token = client.oauth.get_token('XX_CODE_RETURNED_IN_REDIRECT_XX')
# Apply the returned access token to the client
client.set_access_token(access_token)
# Get the user's data
user = client.users()
Instantiating a client
Userless Access
client = foursquare.Foursquare(client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET')
Authenticated User Access (when you already have a user's access_token)
client = foursquare.Foursquare(access_token='USER_ACCESS_TOKEN')
Specifying a specific API version
client = foursquare.Foursquare(client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET', version='20111215')
or
client = foursquare.Foursquare(access_token='USER_ACCESS_TOKEN', version='20111215')
Examples
Users
Getting your own user object
client.users()
Getting another user
client.users('1183247')
Get your checkins
client.users.checkins()
Get your most recent checkin
client.users.checkins(params={'limit': 1})
Get all of your checkins (not a native 4sq call)
client.users.all_checkins()
Approve a friend's friend request
client.users.approve('1183247')
Venues
Get details about a venue
client.venues('40a55d80f964a52020f31ee3')
Search for a coffee place
client.venues.search(params={'query': 'coffee', 'll': '40.7233,-74.0030'})
Edit venue details
client.venues.edit('40a55d80f964a52020f31ee3', params={'description': 'Best restaurant on the city'})
Checkins
Returns a list of recent checkins from friends
client.checkins.recent()
Tips
Get a specific tip
client.tips('53deb1f6498e0d374af17ca7')
Full endpoint list
Note: endpoint methods map one-to-one with foursquare's endpoints
users()
users.requests()
users.checkins()
users.all_checkins() [*not a native endpoint*]
users.friends()
users.lists()
users.mayorships()
users.photos()
users.tips()
users.venuehistory()
users.venuelikes()
users.approve()
users.deny()
users.setpings()
users.unfriend()
users.update()
venues()
venues.add()
venues.categories()
venues.explore()
venues.managed()
venues.search()
venues.suggestcompletion()
venues.trending()
venues.events()
venues.herenow()
venues.links()
venues.listed()
venues.menu()
venues.photos()
venues.similar()
venues.stats()
venues.tips()
venues.nextvenues()
venues.likes()
venues.hours()
venues.edit()
venues.flag()
venues.proposeedit()
venues.setrole()
checkins()
checkins.add()
checkins.recent()
checkins.addcomment()
checkins.addpost()
checkins.deletecomment()
tips()
tips.add()
tips.listed()
tips.unmark()
lists()
lists.add()
lists.followers()
lists.suggestphoto()
lists.suggesttip()
lists.suggestvenues()
lists.additem()
lists.deleteitem()
lists.follow()
lists.moveitem()
lists.share()
lists.unfollow()
lists.update()
lists.updateitem()
photos()
photos.add()
settings()
settings.all()
settings.set()
specials()
specials.search()
specials.add()
specials.flag()
events()
events.categories()
events.search()
pages()
pages.venues()
multi()
Testing
In order to run the tests:
* Copy foursquare/tests/_creds.example.py to foursquare/tests/_creds.py
* Fill in your personal credentials to run the tests (_creds.py is in .gitignore)
* Run nosetests
- If you are hitting quota or rate-limiting errors, try setting the FOURSQUARE_TEST_THROTTLE env variable to an integer like 5. It will pause for this many seconds after every test.
Improvements
Feel free to send pull requests for any improvements you make.
TODO
- Bring in new endpoints as they emerge
- Test coverage for write methods
Code status
Packaging
bash
pip install twine wheel
python setup.py sdist bdist_wheel
twine upload dist/*
License
MIT License. See LICENSE Copyright (c) 2020 Mike Lewis
Owner
- Name: Mike Lewis
- Login: mLewisLogic
- Kind: user
- Location: Santa Cruz, CA
- Company: ex: Fondu, Airbnb, Stripe
- Repositories: 14
- Profile: https://github.com/mLewisLogic
GitHub Events
Total
- Watch event: 2
- Fork event: 1
Last Year
- Watch event: 2
- Fork event: 1
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| mLewisLogic | m****e@f****m | 63 |
| Mike Lewis | m****l@g****m | 56 |
| Mike Lewis | m****s@a****m | 48 |
| mLewisLogic | m****e@g****m | 9 |
| Benn Eichhorn | b****n@r****m | 6 |
| Pak Youngrok | p****k@g****m | 6 |
| Gareth Jones | g****h@g****m | 5 |
| mike wakerly | o****e@h****m | 4 |
| Leo Li | l****o@a****m | 4 |
| Dmitry Lebedev | d****v@g****m | 3 |
| Ahmet Alp Balkan | a****t@a****m | 2 |
| Takuma Hashimoto | m****9@s****p | 2 |
| Harel Williams | h****w@g****m | 2 |
| ImJasonH | i****h@g****m | 2 |
| kamotos | z****0@g****m | 2 |
| iTech Developer | t****r@g****m | 2 |
| elcrimer | e****r@g****m | 2 |
| Ian Dees | i****s@g****m | 1 |
| Arin Ray | a****2@g****m | 1 |
| George Lewis | g****7@n****u | 1 |
| Finn Pauls | d****n@g****m | 1 |
| Jason Ansel | j****l@j****m | 1 |
| Jace Browning | j****g@g****m | 1 |
| Jeff Croft | j****f@j****m | 1 |
| tylercasey | t****r@o****m | 1 |
| Jason Ansel | j****l@j****t | 1 |
| Stephen Young | s****n@t****m | 1 |
| Shakya, Milind | m****a@s****m | 1 |
| SS | g****b@m****c | 1 |
| Michael Hahn | m****n@e****m | 1 |
| and 1 more... | ||
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 47
- Total pull requests: 52
- Average time to close issues: about 2 months
- Average time to close pull requests: about 2 months
- Total issue authors: 41
- Total pull request authors: 33
- Average comments per issue: 3.06
- Average comments per pull request: 1.58
- Merged pull requests: 39
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- ragarwal6397 (2)
- woozyking (2)
- burakgulmez (2)
- jacebrowning (2)
- szs8 (2)
- mohiitarora (1)
- alexdej (1)
- maelfosso (1)
- shaikhsohail30 (1)
- neonichu (1)
- itsMichaelBates (1)
- mcfoton (1)
- elcrimer (1)
- jamesonjlee (1)
- timgates42 (1)
Pull Request Authors
- mLewisLogic (9)
- woozyking (3)
- mik3y (3)
- imjasonh (3)
- ahmetb (2)
- ghost (2)
- benneic (2)
- kamotos (2)
- dmytro-lebedev (2)
- arin-ray (1)
- af12066 (1)
- DrGonzo (1)
- garethpaul (1)
- youngrok (1)
- jasminegao (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 3,473 last-month
- Total dependent packages: 1
- Total dependent repositories: 101
- Total versions: 33
- Total maintainers: 1
pypi.org: foursquare
easy-as-pie foursquare API client
- Homepage: http://github.com/mLewisLogic/foursquare
- Documentation: https://foursquare.readthedocs.io/
- License: MIT License
-
Latest release: 2015.2.2
published over 11 years ago
Rankings
Maintainers (1)
Dependencies
- requests >=2.1
- travis >= 0 development
- travis-lint >= 0 development
