def urlretrieve(url, filename=None, reporthook=None, data=None):
global _urlopener
if not _urlopener:
_urlopener = FancyURLopener()
return _urlopener.retrieve(url, filename, reporthook, data)
from numpy import *
# Download datafile
import urllib
urllib.urlretrieve('http://www.ai-geostats.org/fileadmin/Documents/Data/walker_01.dat',filename='walker_01.dat')
# Whhether to thin dataset; definitely thin it if you're running this example on your laptop!
src/p/y/python-cookbook-HEAD/cb2_examples/cb2_13_0_exm_1.py python-cookbook(Download)
import sys, urllib
def reporthook(*a): print a
for url in sys.argv[1:]:
i = url.rfind('/')
file = url[i+1:]
print url, "->", file
urllib.urlretrieve(url, file, reporthook)
src/m/a/matplotlib-HEAD/py4science/examples/skel/stock_records_skel.py matplotlib(Download)
# the os.path module contains function for checking whether a file
# exists
if not os.path.exists(fname):
urllib.urlretrieve(url, fname)
r = mlab.csv2rec(fname)
# note that the CSV file is sorted most recent date first, so you
src/m/a/matplotlib-HEAD/py4science/examples/stock_records.py matplotlib(Download)
# the os.path module contains function for checking whether a file
# exists
if not os.path.exists(fname):
urllib.urlretrieve(url, fname)
r = mlab.csv2rec(fname)
# note that the CSV file is sorted most recent date first, so you
src/m/a/matplotlib-HEAD/py4science/examples/stock_demo.py matplotlib(Download)
's=%s&d=9&e=20&f=2007&g=d&a=0&b=29&c=1993&ignore=.csv'%ticker
fname = '%s.csv'% ticker
urllib.urlretrieve(url, fname)
# <demo> stop
src/m/a/matplotlib-HEAD/py4science/examples/scrape_key_stats.py matplotlib(Download)
if not os.path.exists(fname):
# build the URL from the format pattern and ticker and grab it with urllib
url = 'http://finance.yahoo.com/q/ks?s=' + ticker
urllib.urlretrieve(url, fname)
print 'fetched %s into %s'%(ticker, fname)
# use time.sleep between grabs to be gentle on the server
time.sleep(0.5)
src/p/y/pys60-HEAD/src/extras/examples/weather_maps.py pys60(Download)
try:
print "Retrieving information..."
urllib.urlretrieve(url, tempfile)
lock=e32.Ao_lock()
content_handler = appuifw.Content_handler(lock.signal)
content_handler.open(tempfile)
src/p/y/pys60-HEAD/src/extras/examples/weather_info.py pys60(Download)
lb.set_list([u"Please wait..."])
appuifw.note(u"Fetching "+ weather_url, 'info')
try:
urllib.urlretrieve(weather_url, tempfile)
f = open(tempfile, 'r')
weatherinfo = f.read()
f.close()
src/p/y/pys60-HEAD/src/extras/examples/GUI_example_2.py pys60(Download)
lb.set_list([u"Please wait..."])
appuifw.note(u"Fetching "+ weather_url, 'info')
try:
urllib.urlretrieve(weather_url, tempfile)
f = open(tempfile, 'r')
weatherinfo = f.read()
f.close()
src/p/y/pys60-HEAD/src/extras/examples/GUI_example_1.py pys60(Download)
try:
print "Retrieving information..."
urllib.urlretrieve(url, tempfile)
lock=e32.Ao_lock()
content_handler = appuifw.Content_handler(lock.signal)
content_handler.open(tempfile)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next