Makes superuser's life easier
- Python 3.7
- Pipenv
- App registered in Foursquare Developers (should have
http://localhost
in App Settings > Redirect URL) - Code editor (highly recommend PyCharm)
-
Clone this repository.
-
Run
pipenv install
-
Create a file
api.txt
with API credentials:client_id=ABCDEF client_secret=GHIJKL
-
Use the api:
from lib.api import FoursquareApi, get_token from lib.models import * api = FoursquareApi(get_token()) user = api.get_user() print(f"Hello, {user.full_name()}!")
Upon first run you will be asked to open the provided URL where you will allow access for your app. Then you will be redirected to http://localhost/?code=XYZ#_=_. Copy the code (between
=
and#
), paste it in the console and you are in! If you want to "log out", delete the createdtoken.txt
file.You can check
example_*.py
for examples.
The rest can be checked in Foursquare Developer docs.
get_user(id: str = "self)
- get user's detailssearch_venues(query: str, ll: str, radius: int, category_ids=None)
- search for venues near locationsearch_venues_multiq(query: List[str], ...)
- same as previous with multiple queriesget_venue(id: str)
- get venue's detailsadd_venue(name: str, ll: str, category_id: str)
- submit new venue with minimally required dataadd_venue_with_data(name: str, ll: str, category_id: str, data: VenueEditRequest)
- same as previous with additional datapropose_edit(id: str, venue: VenueEditRequest)
- submit changes for venueflag_venue(id: str, flag: VenueFlag)
- flags a venue with one of the possible problems