Hey.
I am trying to send a request with the necessary data to the form handler using the POST method.
data = { 'user': 'user', 'pass': 'pass'} dataToReq = urllib.parse.urlencode(data) request = urllib.request.Request('http://example.ru/login.php?', dataToReq) page = urllib.request.urlopen(request) The last line gives the error "TypeError: POST data should be bytes or an iterable of bytes. It cannot be be str". But if you convert dataToReq to bytes, then the handler does not seem to work with this data. In the examples, there is also no need to convert to bytes. How can this problem be solved?