Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example fails with Python 3.6.6 #13

Open
sergey-sobolev opened this issue Sep 23, 2018 · 2 comments
Open

Example fails with Python 3.6.6 #13

sergey-sobolev opened this issue Sep 23, 2018 · 2 comments

Comments

@sergey-sobolev
Copy link

Due to the split of urllib2 into parts (urllib.error, urllib.parse, urllib.request) the library cannot be used with python 3.6.6.

Once the client code updated to urllib another problem occurs:
../python3.6/site-packages/eureka_client/requests.py", line 46, in create
response = request.opener.open(request)
File "/usr/lib/python3.6/urllib/request.py", line 524, in open
req = meth(req)
File "/usr/lib/python3.6/urllib/request.py", line 1248, in do_request

raise TypeError(msg)
TypeError: POST data should be bytes, an iterable of bytes, or a file object. It cannot be of type str.

On SO recommend to encode url into utf-8:
data = urllib.parse.urlencode(data)
data = data.encode('utf-8')

But then another error follows:
..lib/python3.6/site-packages/eureka_client/requests.py", line 42, in create
data = urllib.parse.urlencode(data) # I added this
File "/usr/lib/python3.6/urllib/parse.py", line 864, in urlencode
"or mapping object").with_traceback(tb)
File "/usr/lib/python3.6/urllib/parse.py", line 856, in urlencode
raise TypeError
TypeError: not a valid non-string sequence or mapping object

How to fix it?

@sergey-sobolev
Copy link
Author

also looks like installation for the client could be improved: dependencies are not communicated to pip, as a result one has to install missing libraries one by one while fixing missing packages errors

@sergey-sobolev
Copy link
Author

sergey-sobolev commented Sep 23, 2018

also looks like used package ec2metadata interface has been changed, python complains about missing get method in ec2metadata. This error happens if datacenter is not specified or Amazon (the default option).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant