Casa > I > Is It Possible To Export My Location History From Foursquare?

Is it possible to export my location history from Foursquare?

Here's a Python script that will export your entire checkin history using the Foursquare API.

  1. import requests 
  2. import json 
  3.  
  4. url_template = 'https://api.foursquare.com/v2/users/self/checkins?limit=250&oauth_token={}&v=20131026&offset={}' 
  5.  
  6. token = "" # replace with oauth token 
  7. offset = 0 
  8. data = [] 
  9.  
  10. with open("/tmp/checkins.json", 'w') as f: 
  11. while True: 
  12. response = requests.get(url_template.format(oauth_token, offset)) 
  13. if len(response.json()['response']['checkins']['items']) == 0: 
  14. break 
  15.  
  16. data.append(response.json()) 
  17. offset += 250 
  18.  
  19. f.write(json.dumps(data)) 

Source: https://gist.github.com/dlo/7177249

If you don't already have an oauth token available, visit the Foursquare API Explorer to generate one for you automatically, and then just replace the "token" variable above with it.

Before running the script, you will also need to have installed the "requests" library. E.g.,

  1. pip install requests 

Enjoy!

De Sheline

Como arrefecer o meu portátil :: O que são as séries Netflix para adultos a assistir em 2021?