Closed iamgregg closed 8 years ago
Very strange indeed. I can't seem to reproduce this on my end:
$ rm -f ~/.config/beets/discogs_token.json
$ beet import [...]
To authenticate with Discogs, visit:
https://www.discogs.com/oauth/authorize?oauth_token=[...]
Enter the code:
This is on discogs-client==2.1.0
and requests==2.8.1
, with Python 2.7.10 and the latest beets source.
I am, unfortunately, at a loss regarding what might be different about our setups. Could something be wrong with PyOpenSSL on your machine?
Python 2.7.4 beets 1.3.15 discogs-client 2.1.0 requests 2.8.1
This appears to be a bug with urllib:
Relevant links:
https://github.com/kennethreitz/requests/issues/2818 https://github.com/shazow/urllib3/pull/719 https://github.com/kennethreitz/requests/pull/2821
Some relevant quotes:
To be clear, the error you're encountering is a known bug in urllib3 that has been fixed (see shazow/urllib3#719). However, that fix will not be pulled into the released version of requests until urllib3 ships a new release and then requests ships 2.9.0. Until such time, you could apply the diff from the linked patch to your installation or, alternatively, simply encode the data yourself.
And also
I feel certain that we've fixed this already, perhaps in 3.0.0?
And a quick look shows we fixed it on July 18th: ea1cbb3
I don't see discussion in the bug about why we didn't propose that against master though (although parts of it are backwards incompatible).
I'm +1 on fixing this and this looks like a good, simple, probably backwards compatible change.
It appears I'm waiting for a requests release that fixes an incompatibility issue.
Thanks for digging into the issue—that's disappointing. I'm flying blind here, but I'm going to try making sure that we pass all data to the client as bytestrings. That might work around the problem for now.
Sadly, I had to revert my "fix" as it was causing other crashes inside the discogs library (c.f. #1669). :cry:
Reporting in that the recent urllib3 and requests releases have fixed this issue.
Fantastic news. Thanks for checking back in, @iamgregg.
I'm getting the following traceback error when trying to use the discogs plugin:
I have tried updating both beets and discogs-client using pip, but it still throws the same error.
My config is quite simple as I'm new to beets: