Remove unused urllib2
This commit is contained in:
+6
-22
@@ -3,7 +3,6 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import urllib2
|
|
||||||
import time
|
import time
|
||||||
from xml.dom.minidom import Document
|
from xml.dom.minidom import Document
|
||||||
|
|
||||||
@@ -35,18 +34,6 @@ except ImportError, E:
|
|||||||
feedName = "example-list.xml"
|
feedName = "example-list.xml"
|
||||||
feedPath = "http://openlayers.org/dev/examples/"
|
feedPath = "http://openlayers.org/dev/examples/"
|
||||||
|
|
||||||
def getListOfOnlineExamples(baseUrl):
|
|
||||||
"""
|
|
||||||
useful if you want to get a list of examples a url. not used by default.
|
|
||||||
"""
|
|
||||||
html = urllib2.urlopen(baseUrl)
|
|
||||||
soup = BeautifulSoup(html)
|
|
||||||
examples = soup.findAll('li')
|
|
||||||
examples = [example.find('a').get('href') for example in examples]
|
|
||||||
examples = [example for example in examples if example.endswith('.html')]
|
|
||||||
examples = [example for example in examples]
|
|
||||||
return examples
|
|
||||||
|
|
||||||
def getListOfExamples(relPath):
|
def getListOfExamples(relPath):
|
||||||
"""
|
"""
|
||||||
returns list of .html filenames within a given path - excludes example-list.html
|
returns list of .html filenames within a given path - excludes example-list.html
|
||||||
@@ -56,18 +43,15 @@ def getListOfExamples(relPath):
|
|||||||
return examples
|
return examples
|
||||||
|
|
||||||
|
|
||||||
def getExampleHtml(location):
|
def getExampleHtml(path):
|
||||||
"""
|
"""
|
||||||
returns html of a specific example that is available online or locally
|
returns html of a specific example
|
||||||
"""
|
"""
|
||||||
print '.',
|
print '.',
|
||||||
if location.startswith('http'):
|
f = open(path)
|
||||||
return urllib2.urlopen(location).read()
|
html = f.read()
|
||||||
else:
|
f.close()
|
||||||
f = open(location)
|
return html
|
||||||
html = f.read()
|
|
||||||
f.close()
|
|
||||||
return html
|
|
||||||
|
|
||||||
|
|
||||||
def extractById(soup, tagId, value=None):
|
def extractById(soup, tagId, value=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user