Closed Maj0rrush closed 6 years ago
@Maj0rrush was this working before? I just tried it myself and it's working from my localhost - can you please run the following script in a cgi-bin
folder via python -m CGIHTTPServer 8000
(run this on the same level) and let me know what the response is?
#!/usr/bin/env python
import cgi
import requests
# encoding=utf8
import sys
reload(sys)
sys.setdefaultencoding('utf8')
url = "https://api.openrouteservice.org/directions"
querystring = {"api_key":"xxx","elevation":"true","profile":"driving-car","preference":"recommended","language":"hu","geometry":"true","geometry_format":"geojson","coordinates":"20.1810948,46.269903799999994|27.867883,43.229733|20.001267,45.972317"}
headers = {
'Content-Type': "application/json",
}
response = requests.request("GET", url, headers=headers, params=querystring)
print response.text
Hi .. i have requestet a new api key and now it works again ;-) ... Issue closed for me ...
I have this exact issue.
In the Browser I get:
Access to fetch at %URL% from origin 'https://bicyculty.com' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
And when opening it directly I get:
Hey,
since this morning I always get an error when I make a request via dev machine -> localhost.
Failed to load https://api.openrouteservice.org/directions?api_key=$APIKEY&coordinates=6.93651887827815%2C51.11207410151039%7C6.951238841352023%2C51.09800812671892&profile=foot-walking&geometry_format=geojson
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 403.