def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT):
global _opener
if _opener is None:
_opener = build_opener()
return _opener.open(url, data, timeout)
# Direct connection; Not through API; Prints rows of tables accounts and branches from urllib import urlencode from urllib2 import Request, urlopen url = 'http://rdbhost.com/db/'+'s000015' authcode = 'KF7IUQPlwfSth4sBvjdqqanHkojAZzEjMshrkfEV0O53yz6w6v'
flds1 = [ ('q', x1),('format','xml'),('authcode',authcode)]
postdata = urlencode(flds1)
req.add_data(postdata)
pg=urlopen(req)
text=pg.read()
print text
'''
flds1 = [ ('q', x1),('format','xml'),('authcode',authcode)]
postdata = urlencode(flds1)
req.add_data(postdata)
pg=urlopen(req)
text=pg.read()
print text
src/r/d/Rdbhdb-HEAD/examples/ex4.py Rdbhdb(Download)
# Direct connection; Not through API; Creates table test and then deletes it. from urllib import urlencode from urllib2 import Request, urlopen url = 'http://rdbhost.com/db/'+'s000015' authcode = 'KF7IUQPlwfSth4sBvjdqqanHkojAZzEjMshrkfEV0O53yz6w6v'
flds1 = [ ('q', q1),('format','xml'),('authcode',authcode)]
postdata = urlencode(flds1)
req.add_data(postdata)
pg=urlopen(req)
text=pg.read()
print text
flds2 = [ ('q', q2),('format','xml'),('authcode',authcode)]
postdata = urlencode(flds2)
req.add_data(postdata)
pg=urlopen(req)
src/r/d/Rdbhdb-HEAD/examples/ex10.py Rdbhdb(Download)
# Direct connection; Not through API; Prints rows of tables accounts and branches from urllib import urlencode from urllib2 import Request, urlopen url = 'http://rdbhost.com/db/'+'s000015' authcode = 'KF7IUQPlwfSth4sBvjdqqanHkojAZzEjMshrkfEV0O53yz6w6v'
flds1 = [ ('q', 'SELECT * FROM accounts'),('format','xml'),('authcode',authcode)]
postdata = urlencode(flds1)
req.add_data(postdata)
pg=urlopen(req)
text=pg.read()
print text
flds2 = [ ('q', 'SELECT * FROM branches'),('format','xml'),('authcode',authcode)]
postdata = urlencode(flds2)
req.add_data(postdata)
pg=urlopen(req)
src/r/d/Rdbhdb-HEAD/examples/get_no_table_rows.py Rdbhdb(Download)
# Direct connection; Not through API; Prints rows of tables accounts and branches from urllib import urlencode from urllib2 import Request, urlopen url = 'http://rdbhost.com/db/'+'s000015' authcode = 'KF7IUQPlwfSth4sBvjdqqanHkojAZzEjMshrkfEV0O53yz6w6v'
flds1 = [ ('q', q),('format','xml'),('authcode',authcode)]
postdata = urlencode(flds1)
req.add_data(postdata)
pg=urlopen(req)
text=pg.read()
print text
src/r/d/Rdbhdb-HEAD/examples/ex9.py Rdbhdb(Download)
# Testing Exception Raising. Direct connection (not through API)
from urllib import urlencode
from urllib2 import Request, urlopen
import json
def postit(url,fields):
postdata = urlencode(fields)
headers = {'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': str(len(postdata))}
r = Request(url, postdata, headers)
pg = urlopen(r)
src/c/l/ClientForm-HEAD/examples/simple.py ClientForm(Download)
#!/usr/bin/env python
from urllib2 import urlopen
from ClientForm import ParseResponse
response = urlopen("http://wwwsearch.sourceforge.net/ClientForm/example.html")
forms = ParseResponse(response, backwards_compat=False)
src/w/o/worldcat-HEAD/examples/holdingsmap/holdingsmap.py worldcat(Download)
to run: python holdingsmap.py
point your web browser at http://localhost:8080/
"""
from urllib2 import urlopen, HTTPError
try:
import json as simplejson
except ImportError:
def geocode_url(self, url, exactly_one=True):
page = urlopen(url)
dispatch = getattr(self, 'parse_' + self.output_format)
return dispatch(page, exactly_one)
WSKEY = 'your worldcat api key'
GMAPKEY = 'your google maps api key'
src/i/v/ivy-HEAD/examples/02_graft.py ivy(Download)
fetched directly from the server. """ import sys, os from urllib2 import urlopen import ivy flush = sys.stdout.flush URLBASE = "http://svn.phylodiversity.net/tot/trees" config = urlopen(URLBASE+"/makemega.config")
src/s/k/skeleton-0.6/skeleton/examples/basic-package/distribute_setup.py skeleton(Download)
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
tgz_name = "distribute-%s.tar.gz" % version
url = download_base + tgz_name
saveto = os.path.join(to_dir, tgz_name)
src = dst = None
if not os.path.exists(saveto): # Avoid repeated downloads
try:
log.warn("Downloading %s", url)
src = urlopen(url)
src/c/l/ClientForm-0.2.10/examples/simple.py ClientForm(Download)
#!/usr/bin/env python
from urllib2 import urlopen
from ClientForm import ParseResponse
response = urlopen("http://wwwsearch.sourceforge.net/ClientForm/example.html")
forms = ParseResponse(response, backwards_compat=False)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next