Error in Nominatim - GeocoderInsufficientPrivileges: HTTP Error 403: Forbidden - python

Traceback (most recent call last):
File "geo2.py", line 8, in <module> location = geolocator.geocode(lokacija, timeout=5)
File "/usr/local/lib/python2.7/dist-packages/geopy/geocoders/osm.py", line
192, in geocode self._call_geocoder(url, timeout=timeout), exactly_one
File "/usr/local/lib/python2.7/dist-packages/geopy/geocoders/base.py", line
147, in _call_geocoder
raise ERROR_CODE_MAP[code](message) geopy.exc.GeocoderInsufficientPrivileges: HTTP Error 403: Forbidden
Worked fine till yesterday, now cannot start it.
Did anyone saw this?

Update to the latest version of Nomination. Check this git hub link for the issue.
https://github.com/geopy/geopy/issues/112

Related

Exeeuted in model using python on triton inference server getting issue json parser

python3 /home/ubuntu/Deepthi/triton-inference-server-master/src/clients/python/examples/image_client.py -m /home/ubuntu/Deepthi/triton-inference-server-master/docs/model_repository/resnet50_netdef/1 -s INCEPTION /home/ubuntu/Deepthi/triton-inference-server-master/qa/images/mug.jpg
Traceback (most recent call last):
File "/home/ubuntu/Deepthi/triton-inference-server-master/src/clients/python/examples/image_client.py", line 403, in <module>
model_name=FLAGS.model_name, model_version=FLAGS.model_version)
File "/home/ubuntu/.local/lib/python3.6/site-packages/tritonhttpclient/__init__.py", line 471, in get_model_metadata
_raise_if_error(response)
File "/home/ubuntu/.local/lib/python3.6/site-packages/tritonhttpclient/__init__.py", line 57, in _raise_if_error
error = _get_error(response)
File "/home/ubuntu/.local/lib/python3.6/site-packages/tritonhttpclient/__init__.py", line 46, in _get_error
error_response = json.loads(response.read())
rapidjson.JSONDecodeError: Parse error at offset 0: The document is empty.
I am not getting why I am getting this error, everything is ready .

Error when trying to open a webpage with mechanize

I'm trying to learn mechanize to create a chat logging bot later, so I tested out some basic code
import mechanize as mek
import re
br = mek.Browser()
br.open("google.com")
However, whenever I run it, I get this error.
Traceback (most recent call last):
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/mechanize/_mechanize.py", line 262, in _mech_open
url.get_full_url
AttributeError: 'str' object has no attribute 'get_full_url'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 5, in <module>
br.open("google.com")
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/mechanize/_mechanize.py", line 253, in open
return self._mech_open(url_or_request, data, timeout=timeout)
File "/home/runner/.local/share/virtualenvs/python3/lib/python3.7/site-packages/mechanize/_mechanize.py", line 269, in _mech_open
raise BrowserStateError("can't fetch relative reference: "
mechanize._mechanize.BrowserStateError: can't fetch relative reference: not viewing any document
I double checked with the documentation on the mechanize page and it seems consistent. What am I doing wrong?
You have to use a schema, otherwise mechanize thinks you are trying to open a local/relative path (as the error suggests).
br.open("google.com") should be br.open("http://google.com").
Then you will see an error mechanize._response.httperror_seek_wrapper: HTTP Error 403: b'request disallowed by robots.txt', because google.com does not allow crawlers. This can be remedied with br.set_handle_robots(False) before open.

hubspot3 client and "too many retries" error

I'm trying to pull the details for a contact from hubspot using the recipient's email. I'm using the python3 client "hubspot3" (https://github.com/jpetrucciani/hubspot3).
Here's the code I'm submitting:
import requests
from hubspot3.contacts import ContactsClient
API_KEY=[myapikey]
client=ContactsClient(api_key=API_KEY,debug=True)
email='mytest#gmail.com'
client.get_contact_by_email(email)
The response:
WARNING:root:Too many retries for /contacts/v1/contact/email/nwnippy27+cb1#gmail.com/profile?hapikey=[myapikey]
Traceback (most recent call last):
File "hubspot_api_test.py", line 11, in <module>
client.get_contact_by_email(email)
File "/opt/virtual_env/hubspot-test/lib/python3.7/site-packages/hubspot3/contacts.py", line 38, in get_contact_by_email
"contact/email/{email}/profile".format(email=email), method="GET", **options
File "/opt/virtual_env/hubspot-test/lib/python3.7/site-packages/hubspot3/base.py", line 339, in _call
**options
File "/opt/virtual_env/hubspot-test/lib/python3.7/site-packages/hubspot3/base.py", line 245, in _call_raw
result = self._execute_request_raw(connection, request_info)
File "/opt/virtual_env/hubspot-test/lib/python3.7/site-packages/hubspot3/base.py", line 162, in _execute_request_raw
raise HubspotNotFound(result, request)
hubspot3.error.HubspotNotFound:
Hubspot Error
I'm reading this error as saying that the email address can't be found. Is that correct? If not, I appreciate any intel on the cause and solution.
OK ... so not super useful, but it turned out that this is just the error message you get when the email doesn't exist. After a few tries it gives up, which is why you get the "too many retries" error.

jirashell throws a "KeyError: u'consumer_key'" and does not start

I am new to jira-python and have run into an issue with using jirashell.
jira-python was installed from documentation given here: http://jira.readthedocs.org/en/latest/
When I try to start jirashell using:
ubuntu#ip-10-0-0-12:~$ jirashell -s https://jira.atlassian.com
I get the following error:
Traceback (most recent call last):
File "/usr/local/bin/jirashell", line 11, in <module> sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/jira/jirashell.py", line 248, in main
jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 202, in __init__self._create_oauth_session(oauth)
File "/usr/local/lib/python2.7/dist-packages/jira/client.py", line 1871, in _create_oauth_session
oauth['consumer_key'],
KeyError: u'consumer_key'
I have also tried to get to a server using basic auth but that returns the same error. Using curl works fine, but I wanted to see the objects that are getting returned and get help as I develop by python-jira integration.
Thank you for any insight.

HTTP header error using the Python SDK for Azure

I am starting with Microsoft Azure SDK for Python (https://github.com/Azure/azure-sdk-for-python), but I have problems.
I am using Scientific Linux and I have installed the SDK for Python 3.4 following the next steps:
(instead of the SDK directory)
python setup.py install
after that I created a simple script just to test the connection:
from azure.storage import BlobService
blob_service = BlobService(account_name='thename', account_key='Mxxxxxxx3w==' )
blob_service.create_container('testcontainer')
for i in blob_service.list_containers():
print(i.name)
following this documentation:
http://blogs.msdn.com/b/tconte/archive/2013/04/17/how-to-interact-with-windows-azure-blob-storage-from-linux-using-python.aspx
http://azure.microsoft.com/en-us/documentation/articles/storage-python-how-to-use-blob-storage/#large-blobs
but is not working, I always receive the same error:
python3 test.py
Traceback (most recent call last):
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 143, in _perform_request
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 132, in _perform_request_worker
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/http/httpclient.py", line 247, in perform_request
azure.http.HTTPError: The value for one of the HTTP headers is not in the correct format.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 21, in <module>
blob_service.create_container('testcontainer')
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/blobservice.py", line 192, in create_container
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/__init__.py", line 905, in _dont_fail_on_exist
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/blobservice.py", line 189, in create_container
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/storageclient.py", line 150, in _perform_request
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/storage/__init__.py", line 889, in _storage_error_handler
File "/usr/local/lib/python3.4/site-packages/azure-0.9.0-py3.4.egg/azure/__init__.py", line 929, in _general_error_handler
azure.WindowsAzureError: Unknown error (The value for one of the HTTP headers is not in the correct format.)
<?xml version="1.0" encoding="utf-8"?><Error><Code>InvalidHeaderValue</Code><Message>The value for one of the HTTP headers is not in the correct format.
RequestId:b37c5584-0001-002b-24b8-c2c245000000
Time:2014-11-19T14:54:38.9378626Z</Message><HeaderName>x-ms-version</HeaderName><HeaderValue>2012-02-12</HeaderValue></Error>
Thanks in advance and best regards.
I have this exact same issue. I believe it's a library bug, but the author/s haven't had their say yet.
It looks like the response states the version, but it's actually giving you the header that's wrong. Its value should be "2014-02-14", you can do the fix shown in https://github.com/Azure/azure-sdk-for-python/pull/289 .
Hopefully this will be fixed and nobody will ever read this answer. Cheers!

Categories

Resources