本文整理匯總了Python中addon.common.net.Net.set_user_agent方法的典型用法代碼示例。如果您正苦於以下問題:Python Net.set_user_agent方法的具體用法?Python Net.set_user_agent怎麽用?Python Net.set_user_agent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類addon.common.net.Net
的用法示例。
在下文中一共展示了Net.set_user_agent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_params
# 需要導入模塊: from addon.common.net import Net [as 別名]
# 或者: from addon.common.net.Net import set_user_agent [as 別名]
# -*- coding: cp1252 -*-
# Main Module by: Blazetamer and TheHighway
import urllib,urllib2,re,xbmcplugin,xbmcgui,sys,xbmc,os,xbmcaddon
try: from addon.common.addon import Addon
except:
try: from t0mm0.common.addon import Addon
except: from t0mm0_common_addon import Addon
try: from addon.common.net import Net
except:
try: from t0mm0.common.net import Net
except: from t0mm0_common_net import Net
#Define common.addon
addon_id='plugin.video.phwizard';
AddonTitle='Config Wizard';
# Global Stuff
addon=Addon(addon_id,sys.argv); net=Net(); settings=xbmcaddon.Addon(id=addon_id); net.set_user_agent('Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3');
AddonIcon=settings.getAddonInfo('icon')
AddonFanart=settings.getAddonInfo('fanart')
AddonPath=settings.getAddonInfo('path')
# #
def get_params():
param=[]
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]; cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'): params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&'); param={}
for i in range(len(pairsofparams)):
splitparams={}; splitparams=pairsofparams[i].split('=')
if (len(splitparams))==2: param[splitparams[0]]=splitparams[1]
return param
示例2: Net
# 需要導入模塊: from addon.common.net import Net [as 別名]
# 或者: from addon.common.net.Net import set_user_agent [as 別名]
from addon.common.addon import Addon
except:
from t0mm0.common.addon import Addon
addon_id = 'plugin.video.twomovies'
addon = main.addon
try:
from addon.common.net import Net
except:
from t0mm0.common.net import Net
net = Net(http_debug=True)
newagent ='Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36'
net.set_user_agent(newagent)
base_url = 'http://www.twomovies.name'
#PATHS
artwork = xbmc.translatePath(os.path.join('http://rowthreemedia.com/xbmchub/2movies/art/', ''))
settings = xbmcaddon.Addon(id='plugin.video.twomovies')
addon_path = os.path.join(xbmc.translatePath('special://home/addons'), '')
#========================DLStuff=======================
mode = addon.queries['mode']
url = addon.queries.get('url', '')
name = addon.queries.get('name', '')
thumb = addon.queries.get('thumb', '')
ext = addon.queries.get('ext', '')