I am having following error when generating an Auth Token:
TypeError: a bytes-like object is required, not 'str'
I am Automating a Page and this is my first ever Automation in Python. When I register a user it goes fine but when I try to generate a token based on user name and password it gives the above type error. This error has started to appear when I updated from Python 2.7 to 3.5.1. I have googled and found that it is a new feature in python 3. How should I enter the data to avoid this problem? I am using following to enter data:
browser.find_element_by_id("username").send_keys("Worldmap")
browser.find_element_by_id("password").send_keys("hello")
and the following to generate key:
curl --user Worldmap:hello http://127.0.0.1:8080/api/auth/token
bjust before opening quotes, making themb"Worldmap"andb"hello". In Python2 the types were confusing because you didn't know whether you were dealing with bytes or ASCII string (and having to convert things into unicode strings sucked as well). Now the distinction is nice, but sometimes API calls require bytes objects or return those - like here.browseretc.) could be useful as well.