Closed chid closed 10 years ago
Sorry I'm not sure I understand, could you please provide a code sample?
How about like,
try:
from urllib.request import urlopen, build_opener, Request
from urllib.parse import urlparse, urlencode
from urllib.error import HTTPError
except ImportError:
from urlparse import urlparse
from urllib import urlopen, urlencode
from urllib2 import HTTPError, build_opener, Request
which is what I used in https://github.com/chid/push.co/blob/master/push.py
Edit: I misread your code, looks good, will merge.
I must say, I found that function name UrlLibOpen odd to read
I am merging the album command. Thanks for splitting into atomic commits.
On Python 2.x support, do you think it would be better to refactor the places where it uses
urlencode
andHTTPError
and so on to use generic functions, and polymorphically bind those to python 2.x bindings in python 2.x, and so on?