2019-04-26 18:17:19 +01:00
2019-04-26 17:59:19 +01:00
2019-04-26 17:59:19 +01:00
2019-04-26 17:59:19 +01:00
2019-04-26 17:54:51 +01:00
2019-04-26 17:59:19 +01:00
2019-04-26 17:59:19 +01:00
2019-04-26 18:02:01 +01:00

Foursquare Feeds

A python script that will generate a iCal (.ics) feed of your recent checkins on Foursquare/Swarm.

Foursquare used to have such feeds but they've stopped working for me.

NOTE: This is new and untested!

Installation

1. Make a Foursquare app

Go to https://foursquare.com/developers/apps and create a new App.

2. Install python requirements

Either:

$ pipenv install

or:

$ pip install -r requirements.txt

3. Set up config file

Copy config_example.ini to config.ini. Change the IcsFilepath to wherever you want your file to be saved.

To get the AccessToken for your Foursquare app, you will have to go through the laborious procedure in step 4...

4. Get an access token

On https://foursquare.com/developers/apps, in your app, set the Redirect URI to http://localhost:8000/

In a terminal window, open a python shell:

$ python

and, using your app's Client ID and Client Secret in place of YOUR_CLIENT_ID and YOUR_CLIENT_SECRET enter this:

import foursquare
client = foursquare.Foursquare(client_id='YOUR_CLIENT_ID' client_secret='YOUR_CLIENT_SECRET', redirect_uri='http://localhost:8000')
client.oauth.auth_url()

This will output something like:

'https://foursquare.com/oauth2/authenticate?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2F'

Copy the URL from your terminal without the surrounding quotes and paste it into a web browser.

Your browser should redirect to a URL like the one below, with an error about not being able to connect to the server (unless you have a webserver running locally on your machine):

http://localhost:8000/?code=XX_CODE_RETURNED_IN_REDIRECT_XX#_=_

Copy the code represented by XX_CODE_RETURNED_IN_REDIRECT_XX (note that there may be an extra #_=_ on the end which you should not copy).

Back in your python shell, with that code, enter this, replacing XX_CODE_RETURNED_IN_REDIRECT_XX with the code you just copied:

client.oauth.get_token('XX_CODE_RETURNED_IN_REDIRECT_XX')

This will output another long code, which is your Access Token.

Enter this in your config.ini.

5. Run it

Then run the script:

$ ./generate_feeds.py

It should create an .ics file.

If the file is generated in a location on your website that's publicly-readable, you should be able to subscribe to it from a calendar application. Then run the script periodically to have it update.

Note that the file might contain private checkins or information you don't want to be public. In which case, probably best to make the name of any such publicly-readable file very obscure.

Description
No description provided
Readme BSD-3-Clause 572 KiB
Languages
Python 94.9%
Dockerfile 5.1%