本文整理汇总了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)
示例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
示例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"))
示例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"))
示例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
示例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