Skip to content

Example fails with Python 3.6.6 #13

Description

@sergey-sobolev

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions