Python ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
I'm using [geopy][1] in a Python 3.6 application and I have to run it on an outdated machine that uses Windows 2012 Server. The problem arises when from the application this library is called on this server since it returns the following error:
File "C:ServAPIUtil.py", line 12, in getLocation
location = geolocator.geocode(name)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersosm.py", line 193, in geocode
self._call_geocoder(url, timeout=timeout), exactly_one
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersbase.py", line 171, in _call_geocoder
raise GeocoderServiceError(message)
geopy.exc.GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
How can I fix this problem? I am running Python 3.6.0 on Windows 2012 Server
UPDATE
The code is the next:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim()
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
python windows python-3.x ssl geolocation
add a comment |
I'm using [geopy][1] in a Python 3.6 application and I have to run it on an outdated machine that uses Windows 2012 Server. The problem arises when from the application this library is called on this server since it returns the following error:
File "C:ServAPIUtil.py", line 12, in getLocation
location = geolocator.geocode(name)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersosm.py", line 193, in geocode
self._call_geocoder(url, timeout=timeout), exactly_one
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersbase.py", line 171, in _call_geocoder
raise GeocoderServiceError(message)
geopy.exc.GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
How can I fix this problem? I am running Python 3.6.0 on Windows 2012 Server
UPDATE
The code is the next:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim()
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
python windows python-3.x ssl geolocation
add a comment |
I'm using [geopy][1] in a Python 3.6 application and I have to run it on an outdated machine that uses Windows 2012 Server. The problem arises when from the application this library is called on this server since it returns the following error:
File "C:ServAPIUtil.py", line 12, in getLocation
location = geolocator.geocode(name)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersosm.py", line 193, in geocode
self._call_geocoder(url, timeout=timeout), exactly_one
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersbase.py", line 171, in _call_geocoder
raise GeocoderServiceError(message)
geopy.exc.GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
How can I fix this problem? I am running Python 3.6.0 on Windows 2012 Server
UPDATE
The code is the next:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim()
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
python windows python-3.x ssl geolocation
I'm using [geopy][1] in a Python 3.6 application and I have to run it on an outdated machine that uses Windows 2012 Server. The problem arises when from the application this library is called on this server since it returns the following error:
File "C:ServAPIUtil.py", line 12, in getLocation
location = geolocator.geocode(name)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersosm.py", line 193, in geocode
self._call_geocoder(url, timeout=timeout), exactly_one
File "C:UsersAdministratorAppDataLocalProgramsPythonPython36-32libsite-packagesgeopygeocodersbase.py", line 171, in _call_geocoder
raise GeocoderServiceError(message)
geopy.exc.GeocoderServiceError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748)
How can I fix this problem? I am running Python 3.6.0 on Windows 2012 Server
UPDATE
The code is the next:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim()
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
python windows python-3.x ssl geolocation
python windows python-3.x ssl geolocation
edited Oct 4 '17 at 13:02
jjmartinez
asked Oct 4 '17 at 8:18
jjmartinezjjmartinez
51021128
51021128
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
I had the same problem, but ended up having to install SSL and Certifi as well. I'm not sure if anyone else will have this problem, but if so, here is how I solved it.
First install the Certifi and SSL packages, then
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
geolocator = Nominatim(scheme='http')
location = geolocator.reverse("48.8588443, 2.2943506")
print(location.address)
print (location.raw)
Then, the result is:
Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France
{'place_id': '62005962', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': '5013364', 'lat': '48.8582602', 'lon': '2.29449905431968', 'display_name': 'Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France', 'address': {'attraction': 'Tour Eiffel', 'house_number': '5', 'pedestrian': 'Avenue Anatole France', 'suburb': 'Gros-Caillou', 'city_district': '7e', 'city': 'Paris', 'county': 'Paris', 'state': 'Île-de-France', 'country': 'France', 'postcode': '75007', 'country_code': 'fr'}, 'boundingbox': ['48.8574753', '48.8590465', '2.2933084', '2.2956897']}
add a comment |
Finally, I have the solution:
It is possible that win2012 has outdated SSL library. So, the solution is to indicate explicitly that schema is http:
The correct code is:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
add a comment |
This worked for me
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
nom = Nominatim(scheme = 'http')
nom.geocode('Empire State , Manhattan , NY')
add a comment |
Hello this one worked for me because I am getting error with geopy.geocoders Nomimatim.
from geopy.geocoders import ArcGIS
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = ArcGIS(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46560143%2fpython-ssl-sslerror-ssl-certificate-verify-failed-certificate-verify-failed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
I had the same problem, but ended up having to install SSL and Certifi as well. I'm not sure if anyone else will have this problem, but if so, here is how I solved it.
First install the Certifi and SSL packages, then
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
geolocator = Nominatim(scheme='http')
location = geolocator.reverse("48.8588443, 2.2943506")
print(location.address)
print (location.raw)
Then, the result is:
Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France
{'place_id': '62005962', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': '5013364', 'lat': '48.8582602', 'lon': '2.29449905431968', 'display_name': 'Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France', 'address': {'attraction': 'Tour Eiffel', 'house_number': '5', 'pedestrian': 'Avenue Anatole France', 'suburb': 'Gros-Caillou', 'city_district': '7e', 'city': 'Paris', 'county': 'Paris', 'state': 'Île-de-France', 'country': 'France', 'postcode': '75007', 'country_code': 'fr'}, 'boundingbox': ['48.8574753', '48.8590465', '2.2933084', '2.2956897']}
add a comment |
I had the same problem, but ended up having to install SSL and Certifi as well. I'm not sure if anyone else will have this problem, but if so, here is how I solved it.
First install the Certifi and SSL packages, then
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
geolocator = Nominatim(scheme='http')
location = geolocator.reverse("48.8588443, 2.2943506")
print(location.address)
print (location.raw)
Then, the result is:
Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France
{'place_id': '62005962', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': '5013364', 'lat': '48.8582602', 'lon': '2.29449905431968', 'display_name': 'Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France', 'address': {'attraction': 'Tour Eiffel', 'house_number': '5', 'pedestrian': 'Avenue Anatole France', 'suburb': 'Gros-Caillou', 'city_district': '7e', 'city': 'Paris', 'county': 'Paris', 'state': 'Île-de-France', 'country': 'France', 'postcode': '75007', 'country_code': 'fr'}, 'boundingbox': ['48.8574753', '48.8590465', '2.2933084', '2.2956897']}
add a comment |
I had the same problem, but ended up having to install SSL and Certifi as well. I'm not sure if anyone else will have this problem, but if so, here is how I solved it.
First install the Certifi and SSL packages, then
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
geolocator = Nominatim(scheme='http')
location = geolocator.reverse("48.8588443, 2.2943506")
print(location.address)
print (location.raw)
Then, the result is:
Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France
{'place_id': '62005962', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': '5013364', 'lat': '48.8582602', 'lon': '2.29449905431968', 'display_name': 'Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France', 'address': {'attraction': 'Tour Eiffel', 'house_number': '5', 'pedestrian': 'Avenue Anatole France', 'suburb': 'Gros-Caillou', 'city_district': '7e', 'city': 'Paris', 'county': 'Paris', 'state': 'Île-de-France', 'country': 'France', 'postcode': '75007', 'country_code': 'fr'}, 'boundingbox': ['48.8574753', '48.8590465', '2.2933084', '2.2956897']}
I had the same problem, but ended up having to install SSL and Certifi as well. I'm not sure if anyone else will have this problem, but if so, here is how I solved it.
First install the Certifi and SSL packages, then
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
geolocator = Nominatim(scheme='http')
location = geolocator.reverse("48.8588443, 2.2943506")
print(location.address)
print (location.raw)
Then, the result is:
Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France
{'place_id': '62005962', 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'way', 'osm_id': '5013364', 'lat': '48.8582602', 'lon': '2.29449905431968', 'display_name': 'Tour Eiffel, 5, Avenue Anatole France, Gros-Caillou, 7e, Paris, Île-de-France, France métropolitaine, 75007, France', 'address': {'attraction': 'Tour Eiffel', 'house_number': '5', 'pedestrian': 'Avenue Anatole France', 'suburb': 'Gros-Caillou', 'city_district': '7e', 'city': 'Paris', 'county': 'Paris', 'state': 'Île-de-France', 'country': 'France', 'postcode': '75007', 'country_code': 'fr'}, 'boundingbox': ['48.8574753', '48.8590465', '2.2933084', '2.2956897']}
answered Jun 3 '18 at 10:41
AlmostPittAlmostPitt
940416
940416
add a comment |
add a comment |
Finally, I have the solution:
It is possible that win2012 has outdated SSL library. So, the solution is to indicate explicitly that schema is http:
The correct code is:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
add a comment |
Finally, I have the solution:
It is possible that win2012 has outdated SSL library. So, the solution is to indicate explicitly that schema is http:
The correct code is:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
add a comment |
Finally, I have the solution:
It is possible that win2012 has outdated SSL library. So, the solution is to indicate explicitly that schema is http:
The correct code is:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
Finally, I have the solution:
It is possible that win2012 has outdated SSL library. So, the solution is to indicate explicitly that schema is http:
The correct code is:
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = Nominatim(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
answered Nov 3 '17 at 8:54
jjmartinezjjmartinez
51021128
51021128
add a comment |
add a comment |
This worked for me
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
nom = Nominatim(scheme = 'http')
nom.geocode('Empire State , Manhattan , NY')
add a comment |
This worked for me
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
nom = Nominatim(scheme = 'http')
nom.geocode('Empire State , Manhattan , NY')
add a comment |
This worked for me
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
nom = Nominatim(scheme = 'http')
nom.geocode('Empire State , Manhattan , NY')
This worked for me
import certifi
import ssl
import geopy.geocoders
from geopy.geocoders import Nominatim
ctx = ssl.create_default_context(cafile=certifi.where())
geopy.geocoders.options.default_ssl_context = ctx
nom = Nominatim(scheme = 'http')
nom.geocode('Empire State , Manhattan , NY')
answered Jun 4 '18 at 20:17
HarshaHarsha
112
112
add a comment |
add a comment |
Hello this one worked for me because I am getting error with geopy.geocoders Nomimatim.
from geopy.geocoders import ArcGIS
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = ArcGIS(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
add a comment |
Hello this one worked for me because I am getting error with geopy.geocoders Nomimatim.
from geopy.geocoders import ArcGIS
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = ArcGIS(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
add a comment |
Hello this one worked for me because I am getting error with geopy.geocoders Nomimatim.
from geopy.geocoders import ArcGIS
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = ArcGIS(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
Hello this one worked for me because I am getting error with geopy.geocoders Nomimatim.
from geopy.geocoders import ArcGIS
from geopy.exc import GeocoderTimedOut
def getLocation(name):
geolocator = ArcGIS(scheme='http')
try:
location = geolocator.geocode(name, timeout=5)
return location
except GeocoderTimedOut as e:
print("Error: geocode failed on input %s with message %s" % (e.msg))
answered Dec 28 '18 at 23:11
illys illys
62
62
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46560143%2fpython-ssl-sslerror-ssl-certificate-verify-failed-certificate-verify-failed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown