The original tile server was changed to OpenStreetMap(OSM) tile server in 6f5f9fc. However, it will cause 403 error if there is no User-Agent in header according to OSM's Tile Usage Policy.
I just add the User-Agent in header to solve this problem.
By the way, I think it's better to add the package's version in User-Agent (e.g. StaticMap/0.5.5), one simple way to get it is to use built-in importlib.metadata.version function. Yet this function only works above python 3.8, so I gave up using this approach and only used a plain string in User-Agent in this PR.
The original tile server was changed to OpenStreetMap(OSM) tile server in 6f5f9fc. However, it will cause 403 error if there is no
User-Agent
in header according to OSM's Tile Usage Policy.I just add the
User-Agent
in header to solve this problem.By the way, I think it's better to add the package's version in
User-Agent
(e.g.StaticMap/0.5.5
), one simple way to get it is to use built-inimportlib.metadata.version
function. Yet this function only works above python 3.8, so I gave up using this approach and only used a plain string inUser-Agent
in this PR.