__init__.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:aquests 作者: hansroh 项目源码 文件源码
def _add (method, url, params = None, auth = None, headers = {}, callback = None, meta = None, proxy = None):   
    global _que, _initialized, _dns_query_req, _dns_reqs, _workers

    if not _initialized:        
        configure ()

    if not meta: 
        meta = {}

    meta ['req_id'] = _que.req_id
    meta ['req_method'] = method
    meta ['req_callback'] = callback
    _que.add ((method, url, params, auth, headers, meta, proxy))

    # DNS query for caching and massive
    if not lifetime._polling:
        host = urlparse (url) [1].split (":")[0]
        if _dns_reqs < _workers and host not in _dns_query_req:
            _dns_query_req [host] = None
            _dns_reqs += 1
            adns.query (host, "A", callback = lambda x: None)       
        asyndns.pop_all ()
        asyncore.loop (0.1, count = 2)

    #print ('~~~~~~~~~~~~~~~', asyndns.pool.connections)

#----------------------------------------------------
# Add Reuqest (protocols.*.request) Object
#----------------------------------------------------
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号