python类build_from_document()的实例源码

client.py 文件源码 项目:pygsheets 作者: nithinmurali 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, oauth, http_client=None, retries=1, no_cache=False):
        if no_cache:
            cache = None
        else:
            cache = os.path.join(tempfile.gettempdir(), str(uuid.uuid4()))

        self.oauth = oauth
        http_client = http_client or httplib2.Http(cache=cache, timeout=20)
        http = self.oauth.authorize(http_client)
        data_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
        with open(os.path.join(data_path, "sheets_discovery.json")) as jd:
            self.service = discovery.build_from_document(jload(jd), http=http)
        with open(os.path.join(data_path, "drive_discovery.json")) as jd:
            self.driveService = discovery.build_from_document(jload(jd), http=http)
        self._spreadsheeets = []
        self.batch_requests = dict()
        self.retries = retries
        self.enableTeamDriveSupport = False  # if teamdrive files should be included
        self.teamDriveId = None  # teamdrive to search for spreadsheet
        self._fetch_sheets()
cloudtasks_conductor.py 文件源码 项目:artman 作者: googleapis 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _create_tasks_client():
    credentials = GoogleCredentials.get_application_default()
    with open(
        os.path.join(os.path.dirname(__file__), 'cloudtasks.json'), 'r') as f:
            return build_from_document(f.read(), credentials=credentials)
test_cloudtasks_conductor.py 文件源码 项目:artman 作者: googleapis 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def _create_cloudtasks_client_testing(self, http):
        with open(
            os.path.join(os.path.dirname(__file__),
                         '../../artman/conductors/cloudtasks.json'), 'r') as f:
                return build_from_document(f.read(),  http=http)


问题


面经


文章

微信
公众号

扫码关注公众号