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

--auth does not work with Python 3 #24

Open
frakman1 opened this issue Dec 18, 2018 · 1 comment
Open

--auth does not work with Python 3 #24

frakman1 opened this issue Dec 18, 2018 · 1 comment

Comments

@frakman1
Copy link

I ran the same droopy.py with Python 2 then Python 3.
--auth works as expected with Python 2.
With Python 3.6.4 on Win 7 -64bit, I get this error:

>python droopy.py --auth test:test
Exception happened during processing of request from ('127.0.0.1', 53806)
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 639, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\socketserver.py", line 696, in __init__
    self.handle()
  File "droopy.py", line 352, in handle
    httpserver.BaseHTTPRequestHandler.handle(self)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\server.py", line 418, in handle
    self.handle_one_request()
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\http\server.py", line 406, in handle_one_request
    method()
  File "droopy.py", line 77, in decorated
    expected = 'Basic ' + base64.b64encode(self.auth)
  File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\base64.py", line 58, in b64encode
    encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not 'str'
@frakman1
Copy link
Author

I found the fix to be in this commit

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