コード例 #1
0
ファイル: sapi.py プロジェクト: frnsys/mwlib_simple
 def __init__(self, apiurl):
     self.apiurl = apiurl
     self.baseurl = apiurl  # XXX
     self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.CookieJar()))
     self.edittoken = None
     self.qccount = 0
     self.api_result_limit = conf.get("fetch", "api_result_limit", 500, int)
     self.api_request_limit = conf.get("fetch", "api_request_limit", 15, int)
     self.max_connections = conf.get("fetch", "max_connections", 20, int)
     self.max_retry_count = conf.get("fetch", "max_retry_count", 2, int)
     self.rvlimit = conf.get("fetch", "rvlimit", 500, int)
     self.limit_fetch_semaphore = None
コード例 #2
0
ファイル: sapi.py プロジェクト: hpschry/mwlib
 def __init__(self, apiurl):
     self.apiurl = apiurl
     self.baseurl = apiurl  # XXX
     self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.CookieJar()))
     self.edittoken = None
     self.qccount = 0
     self.api_result_limit = conf.get("fetch", "api_result_limit", 500, int)
     self.api_request_limit = conf.get("fetch", "api_request_limit", 15, int)
     self.max_connections = conf.get("fetch", "max_connections", 20, int)
     self.max_retry_count = conf.get("fetch", "max_retry_count", 2, int)
     self.rvlimit = conf.get("fetch", "rvlimit", 500, int)
     self.limit_fetch_semaphore = None
コード例 #3
0
ファイル: sapi.py プロジェクト: IsaacHaze/mwlib
    def __init__(self, apiurl, username=None, password=None):
        self.apiurl = apiurl
        self.baseurl = apiurl  # XXX

        if username:
            passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
            passman.add_password(None, apiurl, username, password)
            auth_handler = urllib2.HTTPBasicAuthHandler(passman)
            self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.CookieJar()), auth_handler)
        else:
            self.opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookielib.CookieJar()))
        self.opener.addheaders = [('User-Agent', conf.user_agent)]
        self.edittoken = None
        self.qccount = 0
        self.api_result_limit = conf.get("fetch", "api_result_limit", 500, int)
        self.api_request_limit = conf.get("fetch", "api_request_limit", 15, int)
        self.max_connections = conf.get("fetch", "max_connections", 20, int)
        self.max_retry_count = conf.get("fetch", "max_retry_count", 2, int)
        self.rvlimit = conf.get("fetch", "rvlimit", 500, int)
        self.limit_fetch_semaphore = None
コード例 #4
0
    def __init__(self, apiurl, username=None, password=None):
        self.apiurl = apiurl
        self.baseurl = apiurl  # XXX

        if username:
            passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
            passman.add_password(None, apiurl, username, password)
            auth_handler = urllib2.HTTPBasicAuthHandler(passman)
            self.opener = urllib2.build_opener(
                urllib2.HTTPCookieProcessor(cookielib.CookieJar()),
                auth_handler)
        else:
            self.opener = urllib2.build_opener(
                urllib2.HTTPCookieProcessor(cookielib.CookieJar()))

        self.edittoken = None
        self.qccount = 0
        self.api_result_limit = conf.get("fetch", "api_result_limit", 500, int)
        self.api_request_limit = conf.get("fetch", "api_request_limit", 15,
                                          int)
        self.max_connections = conf.get("fetch", "max_connections", 20, int)
        self.max_retry_count = conf.get("fetch", "max_retry_count", 2, int)
        self.rvlimit = conf.get("fetch", "rvlimit", 500, int)
        self.limit_fetch_semaphore = None