iandees / wof-editor

A simple Who's on First editor.
https://writefield.nextzen.org/
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Add a User-Agent header to work around Cloudflare bot protection on WOF data API #64

Closed iandees closed 1 year ago

iandees commented 1 year ago

Fixes #60

When trying to find the Github repo for a particular WOF ID, we would ask the data.whosonfirst.org API, which gives us the repo name so we can continue the editing path. This is fronted by Cloudflare's bot protection system and would 403 when we used the default requests library HTTP User-Agent header, so I am setting a Chrome-like User-Agent instead.

This will likely break at some point in the future when the user agent gets too old and Cloudflare catches on.