MestreLion / humblebundle

API for managing Humble Bundle games library
GNU General Public License v3.0
209 stars 38 forks source link

More compatible with Python v3 #40

Closed chilinux closed 6 years ago

chilinux commented 6 years ago

Minor changes to improve Python v3 support while still allowing Python v2.6/v2.7 to work.

MestreLion commented 6 years ago

Great stuff!!! Thanks!!! I've left a few comments and suggestions, I'll can pull the PR as soon as the fixes are done!

chilinux commented 6 years ago

urllib is already imported so I don't really need to re-import it. I guess if you prefer the syntax of "import urllib.request as urllib2" and "import urllib.parse as urlparse" then it could work that way. I thought it was more straight forward to reference what was already imported. I have it working in both python 2.7.14 and python 3.6.4.

The HTTPError was actually already handled in httpbot. The code for handling HTTPError in the top level script was left over from me starting to port humblebundle.py before porting httpbot.py. I removed the changes to HTTPError from humblebundle.py accordingly.

I haven't tried every feature of the script so there may be additional changes needed to get the python v3 port functional for all flags/uses but I figured this is at least a step in the right direction and required minimal modification so far.

chilinux commented 6 years ago

Some key changes to watch for to avoid incompatibility with python v3: