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


Python config.user方法代码示例

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


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

示例1: generateURL

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def generateURL(self, username, password, uhash, php, **kwargs):
        if not kwargs:
            jsonString = {"": ""}
        else:
            jsonString = kwargs
        currentTimeMillis = str(self.getTime())
        jsonString.update({'time': currentTimeMillis, 'uhash': uhash, 'user': username, 'pass': password})
        jsonString = json.dumps(jsonString, separators=(',', ':'))
        a = self.generateUser(jsonString)
        a2 = self.md5hash(str(len(jsonString)) + self.md5hash(currentTimeMillis))
        str5 = username + self.md5hash(self.md5hash(password))
        str6 = self.md5hash(currentTimeMillis + jsonString)
        a3 = self.md5hash(self.secret + self.md5hash(self.md5hash(self.generateUser(a2))))
        str9 = self.md5hash(a3 + self.generateUser(str5))
        str7 = self.generateUser(str6)
        str8 = self.md5hash(self.md5hash(a3 + self.md5hash(self.md5hash(str9) + str7) + str9 + self.md5hash(str7)))
        return self.url + php + "?user=" + a + "&pass=" + str8 
开发者ID:OlympicCode,项目名称:vHackXTBot-Python,代码行数:19,代码来源:utils.py

示例2: __init__

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def __init__(self):
        self.username = config.user
        self.password = config.password
        self.money = 0
        self.ip = ''
        self.score = ''
        self.netcoins = ''
        self.boosters = ''
        self.rank = ''
        self.uhash = ''
        self.localspyware = ''
        self.remotespyware = ''
        self.email = 0
        self.savedIPs = []
        self.anon_attack = config.anon
        self._init()  # 10 secs 
开发者ID:OlympicCode,项目名称:vHackXTBot-Python,代码行数:18,代码来源:player.py

示例3: search

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def search():
	s_tag = request.form.get('search_url')
	if s_tag == "":
		return render_template('index.html', error = "Please enter a search term")
	else:
		conn = MySQLdb.connect(host , user , passwrd, db)
		cursor = conn.cursor()
		
		search_tag_sql = "SELECT * FROM WEB_URL WHERE TAG = %s" 
		cursor.execute(search_tag_sql , (s_tag, ) )
		search_tag_fetch = cursor.fetchall()
		conn.close()
		return render_template('search.html' , host = shorty_host , search_tag = s_tag , table = search_tag_fetch ) 
开发者ID:highoncarbs,项目名称:shorty,代码行数:15,代码来源:app.py

示例4: list_data

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def list_data(shorty_url):
	
	"""
		Takes short_url for input.
		Returns counter , browser , platform ticks. 
	"""
	conn = MySQLdb.connect(host , user , passwrd, db)
	cursor = conn.cursor()
	su =[shorty_url]
	info_sql = "SELECT URL , S_URL ,TAG FROM WEB_URL WHERE S_URL= %s; "
	counter_sql = "SELECT COUNTER FROM WEB_URL WHERE S_URL= %s; "
	browser_sql = "SELECT CHROME , FIREFOX , SAFARI, OTHER_BROWSER FROM WEB_URL WHERE S_URL =%s;"
	platform_sql = "SELECT ANDROID , IOS , WINDOWS, LINUX , MAC , OTHER_PLATFORM FROM WEB_URL WHERE S_URL = %s;"	
	
	
	# MySQLdb's execute() function expects a list
	# of objects to be converted so we use [arg ,]
	# But for sqlite ( args,) works. 
	
	
	cursor.execute(info_sql , su)
	info_fetch = cursor.fetchone()
	cursor.execute(counter_sql , su)
	counter_fetch = cursor.fetchone()
	cursor.execute(browser_sql,su)
	browser_fetch = cursor.fetchone()
	cursor.execute(platform_sql, su)
	platform_fetch = cursor.fetchone()
	conn.close()
	return info_fetch , counter_fetch , browser_fetch , platform_fetch 
开发者ID:highoncarbs,项目名称:shorty,代码行数:32,代码来源:display_list.py

示例5: __init__

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def __init__(self, config):
        # Prepare the connection to the server
        self.oerp = oerplib.OERP(config.host, protocol=config.protocol, port=config.port)

        # Login (the object returned is a browsable record)
        user = self.oerp.login(config.user, config.password, config.db_name) 
开发者ID:iw3hxn,项目名称:LibrERP,代码行数:8,代码来源:conftest.py

示例6: hello_vcenter

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def hello_vcenter(vchost,username,password,port):
    try:
        si = SmartConnectNoSSL(
            host=vchost,
            user=username,
            pwd=password,
            port=port)

        atexit.register(Disconnect, si)
        return True, "ok"
    except vmodl.MethodFault as error:
        return False, error.msg
    except Exception as e:
        return False, str(e) 
开发者ID:freedomkk-qfeng,项目名称:vsphere-monitor,代码行数:16,代码来源:vsphere-monitor.py

示例7: __init__

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def __init__(self):
        self.secret = "aeffI"
        self.url = "https://api.vhack.cc/v/16/"
        self.username = config.user
        self.password = config.password
        self.user_agent = "" 
开发者ID:OlympicCode,项目名称:vHackXTBot-Python,代码行数:8,代码来源:utils.py

示例8: index

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def index():

	conn = MySQLdb.connect(host , user , passwrd, db)
	cursor = conn.cursor()
	
	# Return the full table to displat on index.
	list_sql = "SELECT * FROM WEB_URL;"
	cursor.execute(list_sql)
	result_all_fetch = cursor.fetchall()

		
	if request.method == 'POST':
		og_url = request.form.get('url_input')
		custom_suff = request.form.get('url_custom')
		tag_url = request.form.get('url_tag')
		if custom_suff == '':
			token_string =  random_token()
		else:
			token_string = custom_suff
		if og_url != '':
			if url_check(og_url) == True:
				
				# Check's for existing suffix 
				check_row = "SELECT S_URL FROM WEB_URL WHERE S_URL = %s FOR UPDATE"
				cursor.execute(check_row,(token_string,))
				check_fetch = cursor.fetchone()

				if (check_fetch is None):
					insert_row = """
						INSERT INTO WEB_URL(URL , S_URL , TAG) VALUES( %s, %s , %s)
						"""
					result_cur = cursor.execute(insert_row ,(og_url , token_string , tag_url,))
					conn.commit()
					conn.close()
					e = ''
					return render_template('index.html' ,shorty_url = shorty_host+token_string , error = e )
				else:
					e = "The Custom suffix already exists . Please use another suffix or leave it blank for random suffix."
					return render_template('index.html' ,table = result_all_fetch, host = shorty_host,error = e)
			else:
				e = "URL entered doesn't seem valid , Enter a valid URL."
				return render_template('index.html' ,table = result_all_fetch, host = shorty_host,error = e)

		else:
			e = "Enter a URL."
			return render_template('index.html' , table = result_all_fetch, host = shorty_host,error = e)
	else:	
		e = ''
		return render_template('index.html',table = result_all_fetch ,host = shorty_host, error = e )
	
# Rerouting funciton 
开发者ID:highoncarbs,项目名称:shorty,代码行数:53,代码来源:app.py

示例9: reroute

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def reroute(short_url):

	conn = MySQLdb.connect(host , user , passwrd, db)
	cursor = conn.cursor()
	platform = request.user_agent.platform
	browser =  request.user_agent.browser
	counter = 1

	# Platform , Browser vars
	
	browser_dict = {'firefox': 0 , 'chrome':0 , 'safari':0 , 'other':0}
	platform_dict = {'windows':0 , 'iphone':0 , 'android':0 , 'linux':0 , 'macos':0 , 'other':0}

	# Analytics
	if browser in browser_dict:
		browser_dict[browser] += 1
	else:								
		browser_dict['other'] += 1
	
	if platform in platform_dict.iterkeys():
		platform_dict[platform] += 1
	else:
		platform_dict['other'] += 1
			
	cursor.execute("SELECT URL FROM WEB_URL WHERE S_URL = %s;" ,(short_url,) )

	try:
		new_url = cursor.fetchone()[0]
		print new_url
		# Update Counters 
		
		counter_sql = "\
				UPDATE {tn} SET COUNTER = COUNTER + {og_counter} , CHROME = CHROME + {og_chrome} , FIREFOX = FIREFOX+{og_firefox} ,\
				SAFARI = SAFARI+{og_safari} , OTHER_BROWSER =OTHER_BROWSER+ {og_oth_brow} , ANDROID = ANDROID +{og_andr} , IOS = IOS +{og_ios},\
				WINDOWS = WINDOWS+{og_windows} , LINUX = LINUX+{og_linux}  , MAC =MAC+ {og_mac} , OTHER_PLATFORM =OTHER_PLATFORM+ {og_plat_other} WHERE S_URL = %s;".\
				format(tn = "WEB_URL" , og_counter = counter , og_chrome = browser_dict['chrome'] , og_firefox = browser_dict['firefox'],\
				og_safari = browser_dict['safari'] , og_oth_brow = browser_dict['other'] , og_andr = platform_dict['android'] , og_ios = platform_dict['iphone'] ,\
				og_windows = platform_dict['windows'] , og_linux = platform_dict['linux'] , og_mac = platform_dict['macos'] , og_plat_other = platform_dict['other'])
		res_update = cursor.execute(counter_sql, (short_url, ))
		conn.commit()
		conn.close()

		return redirect(new_url)

	except Exception as e:
		e = "Something went wrong.Please try again."
		return render_template('404.html') ,404

# Search results 
开发者ID:highoncarbs,项目名称:shorty,代码行数:51,代码来源:app.py

示例10: create_short_url

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def create_short_url():	
	'''
		Takes long _url as url, custom string(opt), 
		tag(opt) for input and returns short_url  
	'''	
	if request.method == 'POST':
		if 'url' in request.args :
			og_url = request.args['url']
			
			if url_check(og_url) is True:
				if 'custom' in request.args :
					token_string = request.args['custom']
					if 'tag' in request.args:
						tag_url = request.args['tag']
					else:
						tag_url = ''
				else:
					token_string = random_token()

					if 'tag' in request.args:
						tag_url = request.args['tag']
					else:
						tag_url = ''

				conn = MySQLdb.connect(host , user , passwrd , db)
				cursor = conn.cursor()
				check_row = "SELECT S_URL FROM WEB_URL WHERE S_URL = %s FOR UPDATE"
				cursor.execute(check_row,(token_string,))
				check_fetch = cursor.fetchone()

				if (check_fetch is None):
					insert_row = """
						INSERT INTO WEB_URL(URL , S_URL , TAG) VALUES( %s, %s , %s)
						"""
					result_cur = cursor.execute(insert_row ,(og_url , token_string , tag_url,))
					
					conn.commit()
					conn.close()

					short_url = shorty_host+token_string 
					long_url = og_url
					data = jsonify({
						'long_url' : og_url,
						'short_url' : short_url,
						'custom' : token_string,
						'tag' : tag_url
					})
				
					return make_response(data , 200)
				else:
					data = jsonify({'error':'suffix already present'})
					return make_response(data , 200)
			else:
				data = jsonify({'error':'URL given is not valid . Enter a valid URL.'})
				return make_response(data , 200)
		else:
			data = jsonify({'error':'invalid request'})
			return make_response(data , 405)
	else:
		data = jsonify({'error':'Invalid Method Used'})
		return make_response(data , 405) 
开发者ID:highoncarbs,项目名称:shorty,代码行数:63,代码来源:shorty_api.py

示例11: run

# 需要导入模块: import config [as 别名]
# 或者: from config import user [as 别名]
def run(host,user,pwd,port,interval):
    try:
        si = SmartConnectNoSSL(host=host, user=user, pwd=pwd, port=port)
        atexit.register(Disconnect, si)
        content = si.RetrieveContent()
        vchtime = si.CurrentTime()

        perf_dict = {}
        perfList = content.perfManager.perfCounter
        for counter in perfList:
            counter_full = "{}.{}.{}".format(counter.groupInfo.key, counter.nameInfo.key, counter.rollupType)
            perf_dict[counter_full] = counter.key

        for datacenter in content.rootFolder.childEntity:
            datacenter_name = datacenter.name.encode("utf8")
            datastores = datacenter.datastore
            for ds in datastores:
                if (ds.name in config.datastore_names) or (len(config.datastore_names) == 0):
                    DatastoreInformation(ds,datacenter_name)

            if hasattr(datacenter.hostFolder, 'childEntity'):
                hostFolder = datacenter.hostFolder
                computeResourceList = []
                computeResourceList = getComputeResource(hostFolder,computeResourceList)
                for computeResource in computeResourceList:
                    ComputeResourceInformation(computeResource,datacenter_name,content,perf_dict,vchtime,interval)
         
        if config.vm_enable == True:
            obj = content.viewManager.CreateContainerView(content.rootFolder, [vim.VirtualMachine], True)
            for vm in obj.view:
                if (vm.name in config.vm_names) or (len(config.vm_names) == 0):
                    tags = "vm=" + vm.name
                    if vm.runtime.powerState == "poweredOn":
                        VmInfo(vm, content, vchtime, interval, perf_dict, tags)
                        add_data("vm.power",1,"GAUGE",tags)
                    else:
                        add_data("vm.power",0,"GAUGE",tags)               

    except vmodl.MethodFault as error:
        print "Caught vmodl fault : " + error.msg
        return False, error.msg
    return True, "ok" 
开发者ID:freedomkk-qfeng,项目名称:vsphere-monitor,代码行数:44,代码来源:vsphere-monitor.py


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