src/p/d/pdb2pqr-HEAD/trunk/pdb2pqr/contrib/numpy-1.1.0/numpy/lib/_datasource.py pdb2pqr(Download)
import os import tempfile from shutil import rmtree from urllib2 import urlopen, URLError from urlparse import urlparse # TODO: .zip support, .tar support?
openedurl = urlopen(path)
file(upath, 'w').write(openedurl.read())
except URLError:
raise URLError("URL not found: ", path)
else:
try:
# TODO: Why not just copy the file with shutils.copyfile?
src/p/d/pdb2pqr-HEAD/pdb2pqr/contrib/numpy-1.1.0/numpy/lib/_datasource.py pdb2pqr(Download)
import os import tempfile from shutil import rmtree from urllib2 import urlopen, URLError from urlparse import urlparse # TODO: .zip support, .tar support?
openedurl = urlopen(path)
file(upath, 'w').write(openedurl.read())
except URLError:
raise URLError("URL not found: ", path)
else:
try:
# TODO: Why not just copy the file with shutils.copyfile?
src/p/y/pyvm-HEAD/projects/python_in_a_can/trunk/win32/mercurial-1.6.4/lib/mercurial/keepalive.py pyvm(Download)
def do_open(self, http_class, req):
host = req.get_host()
if not host:
raise urllib2.URLError('no host given')
try:
h = self._cm.get_ready_conn(host)
self._start_transaction(h, req)
r = h.getresponse()
except (socket.error, httplib.HTTPException), err:
raise urllib2.URLError(err)
# if not a persistent connection, don't try to reuse it
if r.will_close:
else:
h.putrequest('GET', req.get_selector(), **skipheaders)
except (socket.error), err:
raise urllib2.URLError(err)
for k, v in headers.items():
h.putheader(k, v)
h.endheaders()
src/w/3/w3af-HEAD/core/data/url/handlers/HTTPNtlmAuthHandler.py w3af(Download)
host = req.get_host()
if not host:
raise urllib2.URLError('no host given')
h = None
if req.get_full_url().startswith('https://'):
h = httplib.HTTPSConnection(host) # will parse host:port
response.readline = notimplemented
return addinfourl(response, response.msg, req.get_full_url())
except socket.error, err:
raise urllib2.URLError(err)
else:
return None
src/p/y/pyvm-HEAD/projects/python_in_a_can/trunk/win32/mercurial-1.6.4/lib/mercurial/byterange.py pyvm(Download)
if host:
host, port = urllib.splitport(host)
if port or socket.gethostbyname(host) not in self.get_names():
raise urllib2.URLError('file not on local host')
fo = open(localfile,'rb')
brange = req.headers.get('Range', None)
brange = range_header_to_tuple(brange)
try:
host = socket.gethostbyname(host)
except socket.error, msg:
raise urllib2.URLError(msg)
path, attrs = splitattr(req.get_selector())
dirs = path.split('/')
dirs = map(unquote, dirs)
src/p/y/pyload-HEAD/module/network/Keepalive.py pyload(Download)
def do_open(self, req):
host = req.get_host()
if not host:
raise urllib2.URLError('no host given')
try:
h = self._cm.get_ready_conn(host)
self._start_transaction(h, req)
r = h.getresponse()
except (socket.error, httplib.HTTPException), err:
raise urllib2.URLError(err)
# if not a persistent connection, don't try to reuse it
if r.will_close: self._cm.remove(h)
else:
h.putrequest('GET', req.get_selector(), skip_accept_encoding=1)
except (socket.error, httplib.HTTPException), err:
raise urllib2.URLError(err)
for args in self.parent.addheaders:
h.putheader(*args)
src/k/e/keeprunning-HEAD/twill/other_packages/_mechanize_dist/_http.py keeprunning(Download)
import copy, time, tempfile, htmlentitydefs, re, logging, socket, \
urllib2, urllib, httplib, sgmllib
from urllib2 import URLError, HTTPError, BaseHandler
from cStringIO import StringIO
from _request import Request
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host = req.get_host()
if not host:
raise URLError('no host given')
h = http_class(host) # will parse host:port
h.set_debuglevel(self._debuglevel)
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
src/m/y/mypyspace-HEAD/mps/trunk/mps/keepalive.py mypyspace(Download)
def do_open(self, req):
host = req.get_host()
if not host:
raise urllib2.URLError('no host given')
try:
h = self._cm.get_ready_conn(host)
self._start_transaction(h, req)
r = h.getresponse()
except (socket.error, httplib.HTTPException), err:
raise urllib2.URLError(err)
# if not a persistent connection, don't try to reuse it
if r.will_close: self._cm.remove(h)
else:
h.putrequest('GET', req.get_selector())
except (socket.error, httplib.HTTPException), err:
raise urllib2.URLError(err)
for args in self.parent.addheaders:
h.putheader(*args)
src/u/r/urlgrabber-3.1.0/urlgrabber/keepalive.py urlgrabber(Download)
def do_open(self, req):
host = req.get_host()
if not host:
raise urllib2.URLError('no host given')
try:
h = self._cm.get_ready_conn(host)
self._start_transaction(h, req)
r = h.getresponse()
except (socket.error, httplib.HTTPException), err:
raise urllib2.URLError(err)
# if not a persistent connection, don't try to reuse it
if r.will_close: self._cm.remove(h)
else:
h.putrequest('GET', req.get_selector())
except (socket.error, httplib.HTTPException), err:
raise urllib2.URLError(err)
for args in self.parent.addheaders:
h.putheader(*args)
src/m/e/mechanize-HEAD/mechanize/_urllib2_fork.py mechanize(Download)
# support for FileHandler, proxies via environment variables from urllib import localhost, url2pathname, getproxies from urllib2 import HTTPError, URLError import _request import _rfc3986
def do_request_(self, request):
host = request.get_host()
if not host:
raise URLError('no host given')
if request.has_data(): # POST
data = request.get_data()
"""
host_port = req.get_host()
if not host_port:
raise URLError('no host given')
try:
h = http_class(host_port, timeout=req.timeout)
if req._tunnel_host:
if not hasattr(h, "set_tunnel"):
if not hasattr(h, "_set_tunnel"):
raise URLError("HTTPS through proxy not supported "
"(Python >= 2.6.4 required)")
else:
# python 2.6
h.request(req.get_method(), req.get_selector(), req.data, headers)
r = h.getresponse()
except socket.error, err: # XXX what error?
raise URLError(err)
# Pick apart the HTTPResponse object to get the addinfourl
# object initialized properly.
def unknown_open(self, req):
type = req.get_type()
raise URLError('unknown url type: %s' % type)
def parse_keqv_list(l):
"""Parse list of key=value strings where keys are not duplicated."""
parsed = {}
headers, 'file:'+file)
except OSError, msg:
# urllib2 users shouldn't expect OSErrors coming from urlopen()
raise URLError(msg)
raise URLError('file not on local host')
class FTPHandler(BaseHandler):
def ftp_open(self, req):
import ftplib
import mimetypes
host = req.get_host()
if not host:
raise URLError('ftp error: no host given')
try:
host = socket.gethostbyname(host)
except socket.error, msg:
raise URLError(msg)
path, attrs = splitattr(req.get_selector())
dirs = path.split('/')
dirs = map(unquote, dirs)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next