NAME
urllib.request - An extensible library for opening URLs using a variety of protocols
DESCRIPTION
The simplest way to use this module is to call the urlopen function,
which accepts a string containing a URL or a Request object (described
below). It opens the URL and returns the results as file-like
object; the returned object has some extra methods described below.
最简单的方法就是使用urlopen函数,它接收一个url或者请求,然后打开url,返回其内容。 The OpenerDirector manages a collection of Handler objects that do
all the actual work. Each Handler implements a particular protocol or
option. The OpenerDirector is a composite object that invokes the
Handlers needed to open the requested URL. For example, the
HTTPHandler performs HTTP GET and POST requests and deals with
non-error returns. The HTTPRedirectHandler automatically deals with
HTTP 301, 302, 303 and 307 redirect errors, and the HTTPDigestAuthHandler
deals with digest authentication.
openerdirector(向导)管理handler objects(处理指令)的集合,而handler objects则是做所有工作的东西。每个handler都执行一个专门的命令,而openerdirector则类似于一个指令集。比如HTTP处理器(下文handler翻译为处理器)执行http get和post请求,并处理未出现错误的返回结果。http Redirect处理器则处理HTTP 301,302,303,和307的redirect 错误,而http digestauth处理器则处理digest authentication(这是什么?见http://blog.csdn.net/gl1987807/article/details/6090811,类似于加密方式) urlopen(url, data=None) -- Basic usage is the same as original
urllib. pass the url and optionally data to post to an HTTP URL, and
get a file-like object back. One difference is that you can also pass
a Request instance instead of URL. Raises a URLError (subclass of
OSError); for HTTP errors, raises an HTTPError, which can also be
treated as a valid response.
urlopen是最简单的,传入一个url和可选的data值,返回一个像文件一样的东西回来。当然也可以传入一个request instance来代替url,同时也可以产生一个error作为返回值。 build_opener -- Function that creates a new OpenerDirector instance.
Will install the default handlers. Accepts one or more Handlers as
arguments, either instances or Handler classes that it will
instantiate. If one of the argument is a subclass of the default
handler, the argument will be installed instead of the default.
build_opener是产生一个openerdirector实例的函数, 接收1或多个handler作为参数,无论是实例还是handler类都可接受,然后传入的新参数会替代原来的默认参数。 install_opener -- Installs a new opener as the default opener.
这个可以装载一个新的opener作为默认opener objects of interest:
OpenerDirector -- Sets up the User Agent as the Python-urllib client and manages
the Handler classes, while dealing with requests and responses.
Request -- An object that encapsulates the state of a request. The
state can be as simple as the URL. It can also include extra HTTP
headers, e.g. a User-Agent.
请求:用于封装一系列用户的请求,既可以是url,也可以包括额外的http headers,比如user-agent BaseHandler --
一些基础的hanlder internals:
BaseHandler and parent
_call_chain conventions
Example usage:
import urllib.request
# set up authentication info
authinfo = urllib.request.HTTPBasicAuthHandler()
authinfo.add_password(realm='PDQ Application',
uri='https://mahler:8092/site-updates.py',
user='klem',
passwd='geheim$parole')
# build a new opener that adds authentication and caching FTP handlers
opener = urllib.request.build_opener(proxy_support, authinfo,
urllib.request.CacheFTPHandler)
新建一个添加了认证和caching FTP处理器的opener # install it
urllib.request.install_opener(opener)
f = urllib.request.urlopen('http://www.python.org/')
装载它到opener,并赋给f。
class AbstractBasicAuthHandler(builtins.object)
| Methods defined here:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+realm=(["\']?)([^"\']*)\...
class AbstractDigestAuthHandler(builtins.object)
| Methods defined here:
|
| __init__(self, passwd=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_algorithm_impls(self, algorithm)
|
| get_authorization(self, req, chal)
|
| get_cnonce(self, nonce)
|
| get_entity_digest(self, data, chal)
|
| http_error_auth_reqed(self, auth_header, host, req, headers)
|
| reset_retry_count(self)
|
| retry_http_digest_auth(self, req, auth)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class BaseHandler(builtins.object)
| Methods defined here:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| handler_order = 500
class CacheFTPHandler(FTPHandler)
| Method resolution order:
| CacheFTPHandler
| FTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| check_cache(self)
|
| clear_cache(self)
|
| connect_ftp(self, user, passwd, host, port, dirs, timeout)
|
| setMaxConns(self, m)
|
| setTimeout(self, t)
|
| ----------------------------------------------------------------------
| Methods inherited from FTPHandler:
|
| ftp_open(self, req)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class DataHandler(BaseHandler)
| Method resolution order:
| DataHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| data_open(self, req)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class FTPHandler(BaseHandler)
| Method resolution order:
| FTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| connect_ftp(self, user, passwd, host, port, dirs, timeout)
|
| ftp_open(self, req)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class FancyURLopener(URLopener)
| Derived class with handlers for errors we can handle (perhaps).
|
| Method resolution order:
| FancyURLopener
| URLopener
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_user_passwd(self, host, realm, clear_cache=0)
|
| http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
| Error 301 -- also relocated (permanently).
|
| http_error_302(self, url, fp, errcode, errmsg, headers, data=None)
| Error 302 -- relocated (temporarily).
|
| http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
| Error 303 -- also relocated (essentially identical to 302).
|
| http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
| Error 307 -- relocated, but turn POST into error.
|
| http_error_401(self, url, fp, errcode, errmsg, headers, data=None, retry=False)
| Error 401 -- authentication required.
| This function supports Basic authentication only.
|
| http_error_407(self, url, fp, errcode, errmsg, headers, data=None, retry=False)
| Error 407 -- proxy authentication required.
| This function supports Basic authentication only.
|
| http_error_default(self, url, fp, errcode, errmsg, headers)
| Default error handling -- don't raise an exception.
|
| prompt_user_passwd(self, host, realm)
| Override this in a GUI environment!
|
| redirect_internal(self, url, fp, errcode, errmsg, headers, data)
|
| retry_http_basic_auth(self, url, realm, data=None)
|
| retry_https_basic_auth(self, url, realm, data=None)
|
| retry_proxy_http_basic_auth(self, url, realm, data=None)
|
| retry_proxy_https_basic_auth(self, url, realm, data=None)
|
| ----------------------------------------------------------------------
| Methods inherited from URLopener:
|
| __del__(self)
|
| addheader(self, *args)
| Add a header to be used by the HTTP interface only
| e.g. u.addheader('Accept', 'sound/basic')
|
| cleanup(self)
|
| close(self)
|
| http_error(self, url, fp, errcode, errmsg, headers, data=None)
| Handle http errors.
|
| Derived class can override this, or provide specific handlers
| named http_error_DDD where DDD is the 3-digit error code.
|
| open(self, fullurl, data=None)
| Use URLopener().open(file) instead of open(file, 'r').
|
| open_data(self, url, data=None)
| Use "data" URL.
|
| open_file(self, url)
| Use local file or FTP depending on form of URL.
|
| open_ftp(self, url)
| Use FTP protocol.
|
| open_http(self, url, data=None)
| Use HTTP protocol.
|
| open_https(self, url, data=None)
| Use HTTPS protocol.
|
| open_local_file(self, url)
| Use local file.
|
| open_unknown(self, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| open_unknown_proxy(self, proxy, fullurl, data=None)
| Overridable interface to open unknown URL type.
|
| retrieve(self, url, filename=None, reporthook=None, data=None)
| retrieve(url) returns (filename, headers) for a local object
| or (tempfilename, headers) for a remote object.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from URLopener:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from URLopener:
|
| version = 'Python-urllib/3.5'
class FileHandler(BaseHandler)
| Method resolution order:
| FileHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| file_open(self, req)
| # Use local file or FTP depending on form of URL
|
| get_names(self)
|
| open_local_file(self, req)
| # not entirely sure what the rules are here
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| names = None
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPBasicAuthHandler(AbstractBasicAuthHandler, BaseHandler)
| Method resolution order:
| HTTPBasicAuthHandler
| AbstractBasicAuthHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_401(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Authorization'
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractBasicAuthHandler:
|
| __init__(self, password_mgr=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_error_auth_reqed(self, authreq, host, req, headers)
|
| http_request(self, req)
|
| http_response(self, req, response)
|
| https_request = http_request(self, req)
|
| https_response = http_response(self, req, response)
|
| retry_http_basic_auth(self, host, req, realm)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from AbstractBasicAuthHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from AbstractBasicAuthHandler:
|
| rx = re.compile('(?:.*,)*[ \t]*([^ \t]+)[ \t]+realm=(["\']?)([^"\']*)\...
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPCookieProcessor(BaseHandler)
| Method resolution order:
| HTTPCookieProcessor
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| __init__(self, cookiejar=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| http_request(self, request)
|
| http_response(self, request, response)
|
| https_request = http_request(self, request)
|
| https_response = http_response(self, request, response)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPDefaultErrorHandler(BaseHandler)
| Method resolution order:
| HTTPDefaultErrorHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_default(self, req, fp, code, msg, hdrs)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPDigestAuthHandler(BaseHandler, AbstractDigestAuthHandler)
| An authentication protocol defined by RFC 2069
|
| Digest authentication improves on basic authentication because it
| does not transmit passwords in the clear.
|
| Method resolution order:
| HTTPDigestAuthHandler
| BaseHandler
| AbstractDigestAuthHandler
| builtins.object
|
| Methods defined here:
|
| http_error_401(self, req, fp, code, msg, headers)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| auth_header = 'Authorization'
|
| handler_order = 490
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractDigestAuthHandler:
|
| __init__(self, passwd=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| get_algorithm_impls(self, algorithm)
|
| get_authorization(self, req, chal)
|
| get_cnonce(self, nonce)
|
| get_entity_digest(self, data, chal)
|
| http_error_auth_reqed(self, auth_header, host, req, headers)
|
| reset_retry_count(self)
|
| retry_http_digest_auth(self, req, auth)
class HTTPErrorProcessor(BaseHandler)
| Process HTTP error responses.
|
| Method resolution order:
| HTTPErrorProcessor
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_response(self, request, response)
|
| https_response = http_response(self, request, response)
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| handler_order = 1000
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class HTTPHandler(AbstractHTTPHandler)
| Method resolution order:
| HTTPHandler
| AbstractHTTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_open(self, req)
|
| http_request = do_request_(self, request)
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractHTTPHandler:
|
| __init__(self, debuglevel=0)
| Initialize self. See help(type(self)) for accurate signature.
|
| do_open(self, http_class, req, **http_conn_args)
| Return an HTTPResponse object for the request, using http_class.
|
| http_class must implement the HTTPConnection API from http.client.
|
| do_request_(self, request)
|
| set_http_debuglevel(self, level)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPPasswordMgr(builtins.object)
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_password(self, realm, uri, user, passwd)
|
| find_user_password(self, realm, authuri)
|
| is_suburi(self, base, test)
| Check if test is below base in a URI tree
|
| Both args must be URIs in reduced form.
|
| reduce_uri(self, uri, default_port=True)
| Accept authority or URI and extract only the authority and path.
|
| ----------------------------------------------------------------------
| Data descriptors defined here:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class HTTPPasswordMgrWithDefaultRealm(HTTPPasswordMgr)
| Method resolution order:
| HTTPPasswordMgrWithDefaultRealm
| HTTPPasswordMgr
| builtins.object
|
| Methods defined here:
|
| find_user_password(self, realm, authuri)
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPPasswordMgr:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_password(self, realm, uri, user, passwd)
|
| is_suburi(self, base, test)
| Check if test is below base in a URI tree
|
| Both args must be URIs in reduced form.
|
| reduce_uri(self, uri, default_port=True)
| Accept authority or URI and extract only the authority and path.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from HTTPPasswordMgr:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class HTTPPasswordMgrWithPriorAuth(HTTPPasswordMgrWithDefaultRealm)
| Method resolution order:
| HTTPPasswordMgrWithPriorAuth
| HTTPPasswordMgrWithDefaultRealm
| HTTPPasswordMgr
| builtins.object
|
| Methods defined here:
|
| __init__(self, *args, **kwargs)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_password(self, realm, uri, user, passwd, is_authenticated=False)
|
| is_authenticated(self, authuri)
|
| update_authenticated(self, uri, is_authenticated=False)
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPPasswordMgrWithDefaultRealm:
|
| find_user_password(self, realm, authuri)
|
| ----------------------------------------------------------------------
| Methods inherited from HTTPPasswordMgr:
|
| is_suburi(self, base, test)
| Check if test is below base in a URI tree
|
| Both args must be URIs in reduced form.
|
| reduce_uri(self, uri, default_port=True)
| Accept authority or URI and extract only the authority and path.
|
| ----------------------------------------------------------------------
| Data descriptors inherited from HTTPPasswordMgr:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
class HTTPRedirectHandler(BaseHandler)
| Method resolution order:
| HTTPRedirectHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| http_error_301 = http_error_302(self, req, fp, code, msg, headers)
|
| http_error_302(self, req, fp, code, msg, headers)
| # Implementation note: To avoid the server sending us into an
| # infinite loop, the request object needs to track what URLs we
| # have already seen. Do this by adding a handler-specific
| # attribute to the Request object.
|
| http_error_303 = http_error_302(self, req, fp, code, msg, headers)
|
| http_error_307 = http_error_302(self, req, fp, code, msg, headers)
|
| redirect_request(self, req, fp, code, msg, headers, newurl)
| Return a Request or None in response to a redirect.
|
| This is called by the http_error_30x methods when a
| redirection response is received. If a redirection should
| take place, return a new Request to allow http_error_30x to
| perform the redirect. Otherwise, raise HTTPError if no-one
| else should try to handle this url. Return None if you can't
| but another Handler might.
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| inf_msg = 'The HTTP server returned a redirect error that w...n infini...
|
| max_redirections = 10
|
| max_repeats = 4
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class HTTPSHandler(AbstractHTTPHandler)
| Method resolution order:
| HTTPSHandler
| AbstractHTTPHandler
| BaseHandler
| builtins.object
|
| Methods defined here:
|
| __init__(self, debuglevel=0, context=None, check_hostname=None)
| Initialize self. See help(type(self)) for accurate signature.
|
| https_open(self, req)
|
| https_request = do_request_(self, request)
|
| ----------------------------------------------------------------------
| Methods inherited from AbstractHTTPHandler:
|
| do_open(self, http_class, req, **http_conn_args)
| Return an HTTPResponse object for the request, using http_class.
|
| http_class must implement the HTTPConnection API from http.client.
|
| do_request_(self, request)
|
| set_http_debuglevel(self, level)
|
| ----------------------------------------------------------------------
| Methods inherited from BaseHandler:
|
| __lt__(self, other)
| Return self |
| add_parent(self, parent)
|
| close(self)
|
| ----------------------------------------------------------------------
| Data descriptors inherited from BaseHandler:
|
| __dict__
| dictionary for instance variables (if defined)
|
| __weakref__
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from BaseHandler:
|
| handler_order = 500
class OpenerDirector(builtins.object)
| Methods defined here:
|
| __init__(self)
| Initialize self. See help(type(self)) for accurate signature.
|
| add_handler(self, handler)
|
| close(self)
|
| error(self, proto, *args)
|
| open(self, fullurl, data=None, timeout=
1、网络上现成的资料
格式: sed -i "s/查找字段/替换字段/g" `grep 查找字段 -rl 路径`
linux sed 批量替换多个文件中的字符串
sed -i "s/oldstring/newstring/g" `grep oldstring -rl yourdir`
例如:替换/home下所有文件中的www.admi
对于AJAX应用(使用XMLHttpRequests)来说,向服务器发起请求的传统方式是:获取一个XMLHttpRequest对象的引用、发起请求、读取响应、检查状态码,最后处理服务端的响应。整个过程示例如下:
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange
Hive中的排序语法 2014.06.22 ORDER BY
hive中的ORDER BY语句和关系数据库中的sql语法相似。他会对查询结果做全局排序,这意味着所有的数据会传送到一个Reduce任务上,这样会导致在大数量的情况下,花费大量时间。
与数据库中 ORDER BY 的区别在于在hive.mapred.mode = strict模式下,必须指定 limit 否则执行会报错。
post-commit hook failed (exit code 1) with output:
svn: E155004: Working copy 'D:\xx\xxx' locked
svn: E200031: sqlite: attempt to write a readonly database
svn: E200031: sqlite: attempt to write a