本文整理匯總了Python中machine.Machine.set_credentials方法的典型用法代碼示例。如果您正苦於以下問題:Python Machine.set_credentials方法的具體用法?Python Machine.set_credentials怎麽用?Python Machine.set_credentials使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類machine.Machine
的用法示例。
在下文中一共展示了Machine.set_credentials方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Machine
# 需要導入模塊: from machine import Machine [as 別名]
# 或者: from machine.Machine import set_credentials [as 別名]
#!/usr/bin/python
from __future__ import print_function
import MySQLdb as mdb
from threading import Thread
from machine import Machine
import logger
import settings
machines = []
for mData in settings.MACHINES:
m = Machine(mData['ID'],mData['NAME'],mData['URL'])
m.set_credentials(mData['USERNAME'],mData['PASSWORD'])
machines.append(m)
#get the data from the machines
threads = []
for m in machines:
t = Thread(target=m.get_data)
t.start()
threads += [t]
for t in threads:
t.join()
#save the data to the db
dbconnection = None
try:
dbconnection = mdb.connect(settings.DATABASE['HOST'],
settings.DATABASE['USERNAME'],