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


Python Net.split方法代码示例

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


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

示例1: __init__

# 需要导入模块: from addon.common.net import Net [as 别名]
# 或者: from addon.common.net.Net import split [as 别名]
	def __init__(self, load = None, disable = None, cache_results=False):
		self.threadpool_size = 5
		self.cache_results = cache_results
		self._load_list = load
		self._disable_list = disable
		self.enabled_scrapers = 0
		self.active_scrapers = []
		self.supported_scrapers = []
		self._active_scrapers = []
		self._load_scrapers()
		self._enable_scrapers()
		self.search_results = []
		expired = True
		cache_file = vfs.join(DATA_PATH, 'debrid_hosts.cache')
		if vfs.exists(cache_file):
			timestamp = int(time.time())
			m_time = vfs.get_stat(cache_file).st_mtime()
			if (timestamp - m_time) < 86400: expired = False
		
		if expired:
			hosts = {}
			response = Net().http_GET('http://real-debrid.com/api/hosters.php').content
			hosts['rd'] = [x.strip('"') for x in response.split(',')]
			
			response = Net().http_GET('http://alldebrid.com/api.php?action=get_host').content
			hosts['ad'] = [x.strip('"') for x in response.split(',\n')]
			
			response = Net().http_GET('http://premium.rpnet.biz/hoster2.json').content
			hosts['rp'] = json.loads(response)['supported']
			ADDON.save_data(cache_file, hosts)
开发者ID:bialagary,项目名称:mw,代码行数:32,代码来源:__init__.py

示例2: __init__

# 需要导入模块: from addon.common.net import Net [as 别名]
# 或者: from addon.common.net.Net import split [as 别名]
	def __init__(self, load = None, disable = None, cache_results=False):
		self.threadpool_size = 5
		self.cache_results = cache_results
		self._load_list = load
		self._disable_list = disable
		self.enabled_scrapers = 0
		self.active_scrapers = []
		self.supported_scrapers = []
		self._active_scrapers = []
		self._load_scrapers()
		self._enable_scrapers()
		self.search_results = []
		self.show_scraper_progress = ADDON.get_setting('enable_scraper_progress') == 'true'
		
		expired = True
		self.filters = False
		if ADDON.get_setting('enable_result_filters') == 'true':
			cache_file = vfs.join(DATA_PATH, 'filters.cache')
			if vfs.exists(cache_file):
				self.filters = ADDON.load_data(cache_file)
		cache_file = vfs.join(DATA_PATH, 'debrid_hosts.cache')
		if vfs.exists(cache_file):
			timestamp = int(time.time())
			m_time = vfs.get_stat(cache_file).st_mtime()
			if (timestamp - m_time) < 86400: expired = False
		
		if expired:
			hosts = {"pm": [], "rd": [], "ad": [], "rp": []}
			net = Net()
			try:
				customer_id = xbmcaddon.Addon('script.module.urlresolver').getSetting('PremiumizeMeResolver_username')
				pin = xbmcaddon.Addon('script.module.urlresolver').getSetting('PremiumizeMeResolver_password')
				query = {"method": "hosterlist", "params[login]": customer_id, "params[pass]": pin}
				api_url = "http://api.premiumize.me/pm-api/v1.php?" + urllib.urlencode(query)
				response = net.http_GET(api_url).content
				data = json.loads(response)
				if 'result' in data:
					hosts['pm'] = data['result']['hosterlist']
			except: pass

			try:
				response = Net().http_GET('http://real-debrid.com/api/hosters.php').content
				hosts['rd'] = [x.strip('"') for x in response.split(',')]
			except: pass
			
			try:
				response = Net().http_GET('http://alldebrid.com/api.php?action=get_host').content
				hosts['ad'] = [x.strip('"') for x in response.split(',\n')]
			except: pass
				
			try:
				response = Net().http_GET('http://premium.rpnet.biz/hoster2.json').content
				hosts['rp'] = json.loads(response)['supported']
			except: pass

			ADDON.save_data(cache_file, hosts)
开发者ID:c0ns0le,项目名称:YCBuilds,代码行数:58,代码来源:__init__.py


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