当前位置: 首页>>代码示例>>Python>>正文


Python Common.joinurl方法代码示例

本文整理汇总了Python中common.Common.joinurl方法的典型用法代码示例。如果您正苦于以下问题:Python Common.joinurl方法的具体用法?Python Common.joinurl怎么用?Python Common.joinurl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common.Common的用法示例。


在下文中一共展示了Common.joinurl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _build_fs

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import joinurl [as 别名]
    def _build_fs(self, link):
        self.project.log("transaction", "Calculating total GMail items...", "info", True)
        response = Common.webrequest(link, self.oauth_provider.get_auth_header(), self.oauth_provider.http_intercept)
        json_response = json.loads(response)

        if 'nextPageToken' in json_response:
            threads = json_response['threads']
            self._add_items_to_threads(threads)
            next_url = Common.joinurl(self.project.config['API_ENDPOINT'], "users/me/threads?userId=me&includeSpamTrash=true&pageToken={}".format(json_response['nextPageToken']))
            self._build_fs(next_url)
        else:
            items = json_response['threads']
            self._add_items_to_threads(items)
开发者ID:LucaBongiorni,项目名称:searchgiant_cli,代码行数:15,代码来源:GMail.py

示例2: _get_download_url

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import joinurl [as 别名]
    def _get_download_url(self, file):
        if 'downloadUrl' in file:
            return file['downloadUrl']
        if 'exportLinks' in file:
            order = []
            # The following logic makes the program functionality predictable
            # Choose from a preferred list of mimetypes
            # Or else sort the list alphabetically and choose the first option
            # TODO: Find somewhere else to put this list
            if file['mimeType'] == "application/vnd.google-apps.document":
                order.append("application/vnd.openxmlformats-officedocument.wordprocessingml.document")
                order.append("application/vnd.oasis.opendocument.text")
                order.append("application/pdf")
                order.append("application/rtf")
                order.append("text/plain")
                order.append("text/html")
            elif file['mimeType'] == "application/vnd.google-apps.spreadsheet":
                order.append("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
                order.append("application/x-vnd.oasis.opendocument.spreadsheet")
                order.append("text/csv")
                order.append("application/pdf")
            elif file['mimeType'] == "application/vnd.google-apps.drawing":
                order.append("image/png")
                order.append("image/jpeg")
                order.append("image/svg+xml")
                order.append("application/pdf")
            elif file['mimeType'] == "application/vnd.google-apps.presentation":
                order.append("application/vnd.openxmlformats-officedocument.presentationml.presentation")
                order.append("application/pdf")
                order.append("text/plain")
            else:
                order = None

            if order:
                for mtype in order:
                    if mtype in file['exportLinks']:
                        return file['exportLinks'][mtype]

            for key, value in sorted(file['exportLinks'].items()):
                return file['exportLinks'][key]

        if "file" in file:
            return file[0]
        if file['mimeType'] == "application/vnd.google-apps.folder":
            return None
        else:
            dl = Common.joinurl(self.project.config['API_ENDPOINT'], "files/{fileid}?alt=media".format(fileid=file['id']))
            return dl
开发者ID:LucaBongiorni,项目名称:searchgiant_cli,代码行数:50,代码来源:GoogleDrive.py

示例3: initialize_items

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import joinurl [as 别名]
 def initialize_items(self):
     self.files = []
     self.project.log("transaction", "API Endpoint is " + self.project.config['API_ENDPOINT'], "info", True)
     self._build_fs(Common.joinurl(self.project.config['API_ENDPOINT'], "files?maxResults=0"))
开发者ID:LucaBongiorni,项目名称:searchgiant_cli,代码行数:6,代码来源:GoogleDrive.py

示例4: initialize_items

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import joinurl [as 别名]
 def initialize_items(self):
     self.threads = []
     self.project.log("transaction", "API Endpoint is {}".format(self.project.config['API_ENDPOINT']), "info", True)
     self._build_fs(Common.joinurl(self.project.config['API_ENDPOINT'], "users/me/threads?userId=me&includeSpamTrash=true"))
开发者ID:LucaBongiorni,项目名称:searchgiant_cli,代码行数:6,代码来源:GMail.py

示例5: get_message_uri

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import joinurl [as 别名]
 def get_message_uri(self, message):
     id = message['id']
     m_uri = Common.joinurl(self.project.config['API_ENDPOINT'], "users/me/messages/{}?format=raw".format(id))
     return m_uri
开发者ID:LucaBongiorni,项目名称:searchgiant_cli,代码行数:6,代码来源:GMail.py

示例6: get_thread_uri

# 需要导入模块: from common import Common [as 别名]
# 或者: from common.Common import joinurl [as 别名]
 def get_thread_uri(self, thread, format):
     id = thread['id']
     t_uri = Common.joinurl(self.project.config['API_ENDPOINT'], "users/me/threads/{}?format={}".format(id, format))
     return t_uri
开发者ID:LucaBongiorni,项目名称:searchgiant_cli,代码行数:6,代码来源:GMail.py


注:本文中的common.Common.joinurl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。