secynic / ipwhois

Retrieve and parse whois data for IPv4 and IPv6 addresses
https://ipwhois.readthedocs.io/en/latest
BSD 2-Clause "Simplified" License
555 stars 121 forks source link

Unable to Use a Remote Elasticsearch #202

Closed aarvee11 closed 5 years ago

aarvee11 commented 7 years ago

Traceback (most recent call last): File "elastic_search.py", line 145, in <module> es = elasticsearch.Elasticsearch(host=args.host, port=args.port) File "/Library/Python/2.7/site-packages/elasticsearch/client/__init__.py", line 150, in __init__ self.transport = transport_class(_normalize_hosts(hosts), **kwargs) File "/Library/Python/2.7/site-packages/elasticsearch/transport.py", line 116, in __init__ self.set_connections(hosts) File "/Library/Python/2.7/site-packages/elasticsearch/transport.py", line 169, in set_connections connections = map(_create_connection, hosts) File "/Library/Python/2.7/site-packages/elasticsearch/transport.py", line 168, in _create_connection return self.connection_class(**kwargs) File "/Library/Python/2.7/site-packages/elasticsearch/connection/http_urllib3.py", line 56, in __init__ self.pool = pool_class(host, port=port, timeout=self.timeout, maxsize=maxsize, **kw) File "/Library/Python/2.7/site-packages/urllib3/connectionpool.py", line 167, in __init__ ConnectionPool.__init__(self, host, port) File "/Library/Python/2.7/site-packages/urllib3/connectionpool.py", line 71, in __init__ self.host = _ipv6_host(host).lower() File "/Library/Python/2.7/site-packages/urllib3/connectionpool.py", line 903, in _ipv6_host if host.startswith('[') and host.endswith(']'): AttributeError: 'list' object has no attribute 'startswith'

secynic commented 7 years ago

Thanks. I didn't test this example for anything other than local.

The following args.host needs to be changed to args.host[0], and the default changed to ['localhost']: https://github.com/secynic/ipwhois/blob/master/ipwhois/examples/elastic_search/elastic_search.py#L145

secynic commented 5 years ago

Merged in #225