A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
184
stars
43
forks
source link
discovery_client got HTTP 406 response from eureka server. #9
I've deployed a test eureka server (build from master branch) at dev environment and got this error.
[2019-03-07 14:32:49]-[EurekaClient]-[line:874] -WARNING: Eureka server [http://localhost:8080/eureka/v2/] is down, use next url to try.
Traceback (most recent call last):
File "client.py", line 6, in <module>
"http://localhost:8080/eureka/v2/",
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 1125, in init_discovery_client
cli.start()
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 1109, in start
self.__pull_full_registry()
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 890, in __pull_full_registry
self.__try_all_eureka_server(do_pull)
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 884, in __try_all_eureka_server
raise urllib2.URLError("All eureka servers are down!")
urllib.error.URLError: <urlopen error All eureka servers are down!>
GET /eureka/v2/apps/ HTTP/1.1
Accept-Encoding: identity
Host: localhost:8080
User-Agent: Python-urllib/3.6
Connection: close
[2019-03-07 14:35:38]-[EurekaClient]-[line:873] -ERROR: err
Traceback (most recent call last):
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 871, in __try_all_eureka_server
fun(url)
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 888, in do_pull
self.__applications = get_applications(url, self.__regions)
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 370, in get_applications
return _get_applications_(_format_url(eureka_server) + "apps/", regions)
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/eureka_client.py", line 385, in _get_applications_
f = urllib2.urlopen(_url, timeout=_DEFAULT_TIME_OUT)
File "/home/momoka/src/snippets/python/eureka/local/lib64/python3.6/site-packages/py_eureka_client/__urlopen_proxy__.py", line 73, in urlopen
cafile=cafile, capath=capath, cadefault=cadefault, context=context)
File "/usr/lib64/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/usr/lib64/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib64/python3.6/urllib/request.py", line 570, in error
return self._call_chain(*args)
File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib64/python3.6/urllib/request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 406:
After some digging, I've found out since in about 2015 eureka server enforced all responses to GET requests are encoded in gzip by default. see https://github.com/Netflix/eureka/issues/624 .
So I have to configure eureka server to skip this gzip filter in web.xml or rebuild without it.
Would it be a proper solution to support gzipped response in client side?
I've deployed a test eureka server (build from master branch) at dev environment and got this error.
Sample code:
After some digging, I've found out since in about 2015 eureka server enforced all responses to GET requests are encoded in gzip by default. see https://github.com/Netflix/eureka/issues/624 .
So I have to configure eureka server to skip this gzip filter in
web.xml
or rebuild without it.Would it be a proper solution to support gzipped response in client side?