2to3: feeds.py port urllib2

This commit is contained in:
pictuga 2015-02-25 18:22:38 +08:00
parent 4f6f8bd41b
commit 327b8504c4

View File

@ -1,12 +1,10 @@
#!/usr/bin/env python #!/usr/bin/env python
from datetime import datetime from datetime import datetime
from StringIO import StringIO
import re import re
import json import json
import csv import csv
import urllib2
from lxml import etree from lxml import etree
from dateutil import tz from dateutil import tz
@ -23,8 +21,13 @@ json.encoder.c_make_encoder = None
try: try:
from collections import OrderedDict from collections import OrderedDict
from StringIO import StringIO
from urllib2 import urlopen
except ImportError: except ImportError:
from ordereddict import OrderedDict from ordereddict import OrderedDict
from io import StringIO
from urllib.request import urlopen
Element = etree.Element Element = etree.Element
@ -39,7 +42,7 @@ NSMAP = {'atom': 'http://www.w3.org/2005/Atom',
def load(url): def load(url):
d = urllib2.urlopen(url).read() d = urlopen(url).read()
return parse(d) return parse(d)