Skip to main content

A small package providing methods for retrieving Strava's HTTP cookies needed to download Strava's global heatmap in high resolution.

Project description

stravacookies

stravacookies is a small python package providing a few classes for retrieving HTTP cookies from Strava web servers.

These cookies allow web browsers to get the high-resolution version of the Global Strava Heatmap. The very same cookies can also be used by cartographic applications (such as JOSM and Cartograph Maps) to get Strava Heatmap tiles via Tile Map Service (TMS).

Permission to use the hi-res Strava Heatmap in JOSM has been granted by Strava, see https://wiki.openstreetmap.org/wiki/Strava and https://wiki.openstreetmap.org/wiki/Permissions/Strava

How it works

Hi-res Gloval Strava Heatmap is available to Strava registered users only. When you click to https://www.strava.com/heatmap and login to Strava, your browser gets several cookies that it includes in later requests to be granted permission to download the hi-res tiles of the Strava Heatmap.

The authentication process consist of three steps:

  1. The user fills in the login form at https://strava.com/login.
  2. Upon submit, the browser sends a POST request to https://www.strava.com/session, email=<STRAVA_EMAIL>, password=<STRAVA_PASSWORD>, remember-me checkbox set, and in exchange it receives _strava4_session, strava_remember_id, and strava_remember_tokencookies from the server.
  3. The browser sends a GET request to https://heatmap-external-a.strava.com/auth with the previous session cookies set, and gets CloudFront-Signature, CloudFront-Policy, and CloudFront-Key-Pair-Id cookies from server.

The last three cookies are those needed to allow the browser to download the high-res heatmap tiles. Concatenating the cookie strings to the TMS URLs (as shown below) allows external applications (such as JOSM or Cartograph Maps) to download the hi-res tiles from Strava.

Example of a TMS URL that can be used in JOSM to get the hi-res version of the Strava Heatmap:

tms[3,15]:https://heatmap-external-{switch:a,b,c}.strava.com/tiles-auth/run/hot/{zoom}/{x}/{y}.png?Key-Pair-Id=<YOUR_KEY_PAIR_ID_COOKIE_VALUE>&Policy=<YOUR_POLICY_COOKIE_VALUE>&Signature=<YOUR_SIGNATURE_COOKIE_VALUE>

Cookies expire, so it is necessary to re-login to Strava from time to time to get up to date cookies.

Requirements

To download all needed Strava cookies, a Strava account (email/password) is needed. Facebook/Google/Apple login to Strava is not supported. You can register to Strava at https://www.strava.com/register.

Licence

stravacookies is distributed under the GPL v3.0 licence.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stravacookies-1.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

stravacookies-1.1-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file stravacookies-1.1.tar.gz.

File metadata

  • Download URL: stravacookies-1.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.6

File hashes

Hashes for stravacookies-1.1.tar.gz
Algorithm Hash digest
SHA256 9c221ff7ca33566df8295e2e5e3d7ceb22ccc14421bba9515f86c77d31be78c7
MD5 e56873f0bb6a2bade2edc5d07a09d69b
BLAKE2b-256 6d51b04fe3ae4e27f350a1cdcd09ebd9243194686c1a39821408db66091ce60c

See more details on using hashes here.

File details

Details for the file stravacookies-1.1-py3-none-any.whl.

File metadata

  • Download URL: stravacookies-1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.6

File hashes

Hashes for stravacookies-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9aa719bc1486399ca2e5fb813e1a7d70ac2110d052e1e768b5517b28da1f2d45
MD5 8d71fc4bc7c3f8c5df6657d3d96e5c38
BLAKE2b-256 98fbffdfd68feda7abc8ee545661adb518dce8bceb97cb5066a8dceeeb6502a2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page