Closed asabil closed 11 years ago
Awesome! I'll try to find some time to test this soon.
Hi, i've made almost the same changes for Python3 compatibility But I think it's better to use PY3 condition when you get response.content or response.text depends on python version . Otherwise in Python3 in ThirdPartyFailure exceptions you'll get byte array. And it's less readable.
response.text is generally what you want, if the payload received is text. I didn't change the ThirdPartyFailure failure exceptions, because I didn't know exactly how they were used. We should maybe also change them to use response.text instead of response.content?
@asabil if response.text is the same with resp.content.decode(resp.encoding). We need to store correct data when different encoding used
Later i can check both solution on different env
One more comment: in provider/vk.py this part of code will fail in PY3 due to iterated object could not be modified in for loop
def callback(self, request) ....
for k, v in profile.items():
if not v or (isinstance(v, list) and not v[0]):
del profile[k]
,,,
need to change for smt like new_profile = {k:v for (k, v) in profile.items() if not ( not v or (isinstance(v, list) and not v[0]) ) } profile = new_profile
This branch fixes compatibility issues with python3 related to the usage of binaries instead of strings and also incorrect import for urlencode.
I was not able to fully test these changes against python2, and could not test all the affected providers. The only ones I tried were Facebook, Twitter and GoogleOAuth2.