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


Python uuid.getnode方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def __init__(self, email, password):
        self.token=""
        self.email = email
        self.password = password
        hardware_address = str(uuid.getnode()).encode('utf-8')
        self.device_token = hashlib.md5(hardware_address).hexdigest()
        self.session = requests.Session()
        self.token = self.login()
        basic_info = self.get_basic_info()
        self.categories = basic_info["categoryTypes"]
        # self.months = basic_info["GB.months"]
        self.statements = basic_info["accounts"]
        self.fieldnames = [u'id', u'label', u'description', u'date', u'account', u'category',
                           u'subcategory', u'duplicated', u'currency',
                           u'value', u'deleted']
        self.category_resolver = {}
        for categ in self.categories:
            for sub_categ in categ['categories']:
                self.category_resolver[sub_categ['id']] = \
                    (categ['name'], sub_categ['name'])

        self.account_resolver = {}
        for account in self.statements:
            for sub_account in account['statements']:
                self.account_resolver[sub_account['id']] = sub_account['name'] 
開發者ID:hsadok,項目名稱:guiabolso2csv,代碼行數:27,代碼來源:guia_bolso.py

示例2: test_lock_id_default

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def test_lock_id_default(self):

        expected = '%012x' % uuid.getnode()

        k = zkutil.lock_id()
        dd(config)
        dd(k)
        self.assertEqual(expected, k.split('-')[0])

        k = zkutil.lock_id(node_id=None)
        dd(k)
        self.assertEqual(expected, k.split('-')[0])

        config.zk_node_id = 'a'
        k = zkutil.lock_id(node_id=None)
        dd(k)
        self.assertEqual('a', k.split('-')[0]) 
開發者ID:bsc-s2,項目名稱:pykit,代碼行數:19,代碼來源:test_zkutil.py

示例3: get_info

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def get_info(self):
		macaddr = uuid.getnode()
		macaddr = ':'.join(("%012X" % macaddr)[i : i + 2] for i in range(0, 12, 2))
		
		fingerprint = Kdatabase().get_obj("fingerprint")

		return {
			"user_id" : Kdatabase().get_obj("setting")["username"],
			"fullname" : Kdatabase().get_obj("setting")["username"],
			"distro" : common.get_distribution(),
			"os_name" : platform.system(),
			"macaddr" : macaddr,
			"user" : getpass.getuser(),
			"localip" : common.get_ip_gateway(),
			"hostname" : platform.node(),
			"platform" : platform.platform(),
			"version" : constant.VERSION,
			"open_ports" : len(fingerprint["port"]["current"]),
			"accounts" : len(fingerprint["account"]["current"]),
			"uuid" : Kdatabase().get_obj("basic")["uuid"],
			"startup_counts": Kdatabase().get_obj("basic")["startup_counts"]
		} 
開發者ID:turingsec,項目名稱:marsnake,代碼行數:24,代碼來源:__init__.py

示例4: __init__

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def __init__(self, account, password):

        # 初始化父類
        super(gfLoginSession, self).__init__(account=account, password=password)

        # TODO 從係統中讀取磁盤編號
        self.disknum = "S2ZWJ9AF517295"
        self.mac_address = ("".join(c + "-" if i % 2 else c for i, c in \
                                    enumerate(hex(uuid.getnode())[2:].zfill(12)))[:-1]).upper()
        # 校驗碼的正則表達式
        self.code_rule = re.compile("^[A-Za-z0-9]{5}$")

        # 交易用的sessionId
        self._dse_sessionId = None

        # 融資融券標誌
        self.margin_flags = False 
開發者ID:vex1023,項目名稱:vxTrader,代碼行數:19,代碼來源:gfTrader.py

示例5: __init__

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def __init__(self, account, password):

        # 初始化父類
        super(yjbLoginSession, self).__init__(account=account, password=password)

        # 初始化登錄參數
        self.mac_address = ("".join(c + "-" if i % 2 else c for i, c in \
                                    enumerate(hex(uuid.getnode())[2:].zfill(12)))[:-1]).upper()

        # TODO disk_serial_id and cpuid machinecode 修改為實時獲取
        self.disk_serial_id = "ST3250890AS"
        self.cpuid = "-41315-FA76111D"
        self.machinecode = "-41315-FA76111D"

        # 校驗碼規則
        self.code_rule = re.compile("^[0-9]{4}$")

        if datetime.now() > datetime(year=2016, month=11, day=30, hour=0):
            # raise TraderAPIError('傭金寶交易接口已於2016年11月30日關閉')
            logger.warning('傭金寶交易接口已於2016年11月30日關閉')
        else:
            logger.warning('傭金寶交易接口將於2016年11月30日關閉') 
開發者ID:vex1023,項目名稱:vxTrader,代碼行數:24,代碼來源:yjbTrader.py

示例6: network

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def network(environ, response, parameter=None):
	status = "200 OK"
	
	header = [
		("Content-Type", "application/json"),
		("Cache-Control", "no-store, no-cache, must-revalidate"),
		("Expires", "0")
	]

	result = {
		"hostname": socket.gethostname(),
        "ip": socket.gethostbyname(socket.gethostname()),
        "ipv4": requests.get('https://api.ipify.org').text,
        "ipv6": requests.get('https://api6.ipify.org').text,
        "mac_address": get_mac()
	}

	response(status, header)
	return [json.dumps(result).encode()] 
開發者ID:victorqribeiro,項目名稱:rpiapi,代碼行數:21,代碼來源:network.py

示例7: __init__

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def __init__(self, address, port):
        self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        self.server.settimeout(10)
        self.serverIP = address#socket.gethostname()
        self.serverConnected = False
        print(self.serverIP)
        self.serverPort = port#5069
        myIP = socket.gethostname()
        self.networkReady = False
        self.delim = b'\x1E'
        self.buffer = b''
        self.state = FSNObjects.PlayerState(None, None, None, None, None, None, None)
        self.messageHandler = None
        self.serverReady = True
        self.readyToQuit = False
        self.clientID = str(time.perf_counter())+str(get_mac()) 
開發者ID:skyfpv,項目名稱:FlowState,代碼行數:18,代碼來源:FSNClient.py

示例8: login

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def login(self, username, password, state=None, sync=True):
        """Authenticate to Google with the provided credentials & sync.

        Args:
            email (str): The account to use.
            password (str): The account password.
            state (dict): Serialized state to load.

        Raises:
            LoginException: If there was a problem logging in.
        """
        auth = APIAuth(self.OAUTH_SCOPES)

        ret = auth.login(username, password, get_mac())
        if ret:
            self.load(auth, state, sync)

        return ret 
開發者ID:kiwiz,項目名稱:gkeepapi,代碼行數:20,代碼來源:__init__.py

示例9: resume

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def resume(self, email, master_token, state=None, sync=True):
        """Authenticate to Google with the provided master token & sync.

        Args:
            email (str): The account to use.
            master_token (str): The master token.
            state (dict): Serialized state to load.

        Raises:
            LoginException: If there was a problem logging in.
        """
        auth = APIAuth(self.OAUTH_SCOPES)

        ret = auth.load(email, master_token, android_id=get_mac())
        if ret:
            self.load(auth, state, sync)

        return ret 
開發者ID:kiwiz,項目名稱:gkeepapi,代碼行數:20,代碼來源:__init__.py

示例10: oid

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def oid(timestamp_factory=IncreasingMicrosecondClock()):
    """Generate unique identifiers for objects in string format.

    The lexicographical order of these strings are roughly same as their
    generation times.

    Internally, an object ID is composed of a timestamp and the node ID
    so that IDs generated from different nodes can also be compared and
    be ensured to be unique.

    :param timestamp_factory: the timestamp generator
    :return: A string can be used as an UUID.
    """
    timestamp = timestamp_factory()
    ns = timestamp * 1e9
    ts = int(ns // 100) + 0x01b21dd213814000L

    node = uuid.getnode()
    num = (ts << 48L) | node
    return _base58_encode(num) 
開發者ID:eavatar,項目名稱:eavatar-me,代碼行數:22,代碼來源:time_uuid.py

示例11: cd_mac_uuid

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def cd_mac_uuid():
    """
    :return: 網卡作為設備號
    """
    return uuid.UUID(int=uuid.getnode()).hex[-12:] 
開發者ID:liucaide,項目名稱:Andromeda,代碼行數:7,代碼來源:cd_tools.py

示例12: get_mac_address

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def get_mac_address():
    h = iter(hex(get_mac())[2:].zfill(12))
    return ":".join(i + next(h) for i in h) 
開發者ID:huge-success,項目名稱:sanic,代碼行數:5,代碼來源:logdna_example.py

示例13: generate_system_id

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def generate_system_id(self):
        mac_address = uuid.getnode()
        pid = os.getpid()
        system_id = (((mac_address & 0xffffffffff) << 24) |
                     (pid & 0xffff) << 8 |
                     (self._node_nr & 0xff)
                     )

        return system_id 
開發者ID:brunorijsman,項目名稱:rift-python,代碼行數:11,代碼來源:node.py

示例14: get_localhost_details

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def get_localhost_details(interfaces_eth, interfaces_wlan):
    hostdata = "None"
    hostname = "None"
    windows_ip = "None"
    eth_ip = "None"
    wlan_ip = "None"
    host_fqdn = "None"
    eth_mac = "None"
    wlan_mac = "None"
    windows_mac = "None"
    hostname = socket.gethostbyname(socket.gethostname())
    if hostname.startswith("127.") and os.name != "nt":
        hostdata = socket.gethostbyaddr(socket.gethostname())
        hostname = str(hostdata[1]).strip('[]')
        host_fqdn = socket.getfqdn()
        for interface in interfaces_eth:
            try:
                eth_ip = get_ip(interface)
                if not "None" in eth_ip:
                    eth_mac = get_mac_address(interface)
                break
            except IOError:
                pass
        for interface in interfaces_wlan:
            try:
                wlan_ip = get_ip(interface)
                if not "None" in wlan_ip:
                    wlan_mac = get_mac_address(interface)
                break
            except IOError:
                pass
    else:
        windows_ip = socket.gethostbyname(socket.gethostname())
        windows_mac = uuid.getnode()
        windows_mac = ':'.join(("%012X" % windows_mac)[i:i+2] for i in range(0, 12, 2))
        hostdata = socket.gethostbyaddr(socket.gethostname())
        hostname = str(socket.gethostname())
        host_fqdn = socket.getfqdn()
    return hostdata, hostname, windows_ip, eth_ip, wlan_ip, host_fqdn, eth_mac, wlan_mac, windows_mac 
開發者ID:funkandwagnalls,項目名稱:pythonpentest,代碼行數:41,代碼來源:hostdetails.py

示例15: getmac

# 需要導入模塊: import uuid [as 別名]
# 或者: from uuid import getnode [as 別名]
def getmac():
    mac = uuid.getnode()
    mac_formated = ':'.join(("%012x" % mac)[i:i+2] for i in range(0, 12, 2))
    return mac_formated 
開發者ID:syncloud,項目名稱:platform,代碼行數:6,代碼來源:id.py


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