當前位置: 首頁>>代碼示例>>Python>>正文


Python Mega.get_public_url_info方法代碼示例

本文整理匯總了Python中mega.Mega.get_public_url_info方法的典型用法代碼示例。如果您正苦於以下問題:Python Mega.get_public_url_info方法的具體用法?Python Mega.get_public_url_info怎麽用?Python Mega.get_public_url_info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mega.Mega的用法示例。


在下文中一共展示了Mega.get_public_url_info方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: BotModule

# 需要導入模塊: from mega import Mega [as 別名]
# 或者: from mega.Mega import get_public_url_info [as 別名]
class BotModule(object):
	def __init__(self, storage):
		self.storage = storage
		self.admins = {}
		self.bot = None

		sys.stdout.write(' (logging in to mega.co.nz) ')
		self.mega = Mega({'verbose': True})
		self.mega.login_anonymous()
	def event(self, ev):
		if ev['name'] == 'msg':
			split = ev['msg'].split(' ')

			for word in split:
				if (word.lower().find('https://mega.co.nz/#!') == 0) or (word.lower().find('http://mega.co.nz/#!') == 0):
					try:
						info = self.mega.get_public_url_info(word)
						assert(info.get('name') != None)
						assert(info.get('size') != None)
					except Exception, e:
						ev['to'].msg('There was an error fetching Mega info from that link, it may be private or there may have happened a communication error. Sorry.')
						return

					ev['to'].msg(chr(3)+ '5Mega| ' + chr(15) +chr(2) + info['name'] + chr(15) + ' [' + fmt(info['size']) + ']')
開發者ID:HarHar,項目名稱:NiNiModules,代碼行數:26,代碼來源:megaconz.py


注:本文中的mega.Mega.get_public_url_info方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。