AtrributeError: 'str' object has no attribute 'get'
Running Ubuntu 18.04 Installed docker and built docker image and installed python dependencies but same error on both when attempting to run with a proxy.
/home/user/maltrieve/grequests.py:21: MonkeyPatchWarning: Patching more than once will result in the union of all True parameters being patched curious_george.patch_all(thread=False, select=False) Traceback (most recent call last): File "maltrieve.py", line 613, in
sys.exit(main()) File "maltrieve.py", line 595, in main maltrieve = Maltrieve(sys.argv[1:]) File "maltrieve.py", line 428, in init check_options(self.opts) File "maltrieve.py", line 322, in check_options check_proxy(opts) File "maltrieve.py", line 63, in check_proxy my_ip = requests.get('http://ipinfo.io/ip', proxies=opts.proxy).text File "/home/user/.local/lib/python2.7/site-packages/requests/api.py", line 75, in get return request('get', url, params=params, **kwargs) File "/home/user/.local/lib/python2.7/site-packages/requests/api.py", line 60, in request return session.request(method=method, url=url, **kwargs) File "/home/user/.local/lib/python2.7/site-packages/requests/sessions.py", line 524, in request prep.url, proxies, stream, verify, cert File "/home/user/.local/lib/python2.7/site-packages/requests/sessions.py", line 699, in merge_environment_settings no_proxy = proxies.get('no_proxy') if proxies is not None else None AttributeError: 'str' object has no attribute 'get'
Oh hmmm...
From http://docs.python-requests.org/en/master/api/?highlight=proxy
It seems that the proxies argument needs to be a dictionary of proxies, but it seems that a single string is being passed.
This seems to be accounted for somewhere in maltrieve.py, so I'm not 100% sure why it's breaking, I should try running it locally and see if I can debug / submit a fix.
Yeah its odd. I have tried even running with the option formatted like a dictionary so:
'"ip":"port"'
but no matter how I try to format it I get the same error
The requests documentation says:
proxies = {
"http": "10.10.1.10:3128", # use http://10.10.1.10:3128 instead
}
# In requests 1.x, this was legal, in requests 2.x,
# this raises requests.exceptions.MissingSchema
requests.get("http://example.org", proxies=proxies)
So in my command I have used:
-p "http":"127.0.0.1:1111" -p "http://127.0.0.1:1111"
but these have not worked either, producing the same error?