예제 #1
0
    def get_api(self):
        if self.username:
            api = mwapi.mwapi(self.api_url, self.username, self.password)
        else:
            api = mwapi.mwapi(self.api_url)
        api.set_limit()

        if self.username:
            api.login(self.username, self.password, self.domain)
        return api
예제 #2
0
    def get_api(self):
        if self.username:
            api = mwapi.mwapi(self.api_url, self.username, self.password)
        else:
            api = mwapi.mwapi(self.api_url)
        api.set_limit()

        if self.username:
            api.login(self.username, self.password, self.domain)
        return api
예제 #3
0
파일: fetch.py 프로젝트: vprusa/mwlib
    def _get_mwapi_for_path(self, path):
        urls = mwapi.guess_api_urls(path)
        for url in urls:
            if url in self.api_cache:
                return self.api_cache[url]
        for url in urls:
            try:
                api = mwapi.mwapi(url)
                api.ping()
                api.set_limit()
                self.api_cache[url] = api
                return api
            except Exception:
                # traceback.print_exc()
                continue

        raise RuntimeError("cannot guess api url for %r" % (path,))