Closed Koecky closed 6 years ago
Hey @Koecky,
I think you're trying to insert you actual key into environ
. You only need to use this if you're getting the key from an environment variable.
If you just want to put your key into you script (be careful when sharing the script in this case), you just need to add the key as a string. E.g.
import what3words
api_key = 'aaabbbcccddd'
environ
is used for getting environment variables from your shell. E.g.
(in Bash etc.)
export MY_KEY='aaabbbcccddd'
(in Python)
import what3words
from os import environ
api_key = environ['MY_KEY']
Thanks @joedborg
Traceback (most recent call last):
File "D:/Users/xxxxxxxxx/Desktop/test.py", line 8, in
I think, I need a proxy authentication.
like this:
httpProxy = {'username': 'xxxxxxxxxxxxxx', 'password': 'xxxxxxxxxxxx', 'host': 'HOST', 'port': 'PORT'} proxyHandler = urllib2.ProxyHandler({'http': 'http://'+httpProxy['username']+':'+httpProxy['password']+'@'+httpProxy['host']+':'+httpProxy['port']}) proxyOpener = urllib2.build_opener(proxyHandler) urllib2.install_opener(proxyOpener)
... but I don't know the host and the port from the company
Yes, I'm afraid you'd have to get that from your IT department.
I check it at home and if it works I will go to the IT department.
I am closing the issue, feel free to contact us at our support email if needed
Hello @all
I get a KeyError. Here my Script:
import what3words from os import environ api_key = environ['xxxxxxxx'] w3w = what3words.Geocoder(api_key) res = w3w.reverse(lat=51.484463, lng=-0.195405) print(res)
and here the error message:
Traceback (most recent call last): File "D:/Users/name/Desktop/test.py", line 5, in
api_key = environ['xxxxxxxx']
File "E:\Python27\ArcGISx6410.3\lib\os.py", line 425, in getitem
return self.data[key.upper()]
KeyError: 'xxxxxxxx'
and I'm confused, because there is no call on the webpage what3words.com/account/developer for the API-Key.
Sorry for my bad english ... :(