本文整理汇总了Python中Pubnub.Pubnub.uuid方法的典型用法代码示例。如果您正苦于以下问题:Python Pubnub.uuid方法的具体用法?Python Pubnub.uuid怎么用?Python Pubnub.uuid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pubnub.Pubnub
的用法示例。
在下文中一共展示了Pubnub.uuid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Copyright
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import uuid [as 别名]
## www.pubnub.com - PubNub Real-time push service in the cloud.
# coding=utf8
## PubNub Real-time Push APIs and Notifications Framework
## Copyright (c) 2010 Stephen Blum
## http://www.pubnub.com/
## -----------------------------------
## PubNub 3.1 Real-time Push Cloud API
## -----------------------------------
import sys
from twisted.internet import reactor
sys.path.append('../')
from Pubnub import Pubnub
## -----------------------------------------------------------------------
## Initiate Pubnub State
## -----------------------------------------------------------------------
pubnub = Pubnub( "", "", "", False )
## -----------------------------------------------------------------------
## UUID Example
## -----------------------------------------------------------------------
uuid = pubnub.uuid()
print "UUID: "
print uuid
示例2: int
# 需要导入模块: from Pubnub import Pubnub [as 别名]
# 或者: from Pubnub.Pubnub import uuid [as 别名]
diskSize = int(ps.disk_usage(disks[0].mountpoint).total / 1000000) #Disk Size in MB
fr = open('/proc/cpuinfo', 'r')
cpuInfo = fr.readlines()
fr.close()
for line in cpuInfo:
if 'MHz' in line:
cpuMaxSpeed = int(float(line.split(':')[1].strip()))
if config['DEFAULT']['Activated'] == 'no':
payload = {"servergroup_id": 0, "name": osDetails.nodename, "available_disk": diskSize, "available_ram": ramTotal, "cpu_speed": cpuMaxSpeed, "os_name": osName, "os_version": osVersion, "guid": pubnub.uuid}
resp = requests.post("http://cadence-bu.cloudapp.net/servers", data=payload, auth=(authUser, authPassword))
print (resp)
config['DEFAULT'] = {'ServerId': resp.json()['id'], 'Activated': 'yes', 'Uuid': pubnub.uuid}
with open(configFile, 'w') as configfile:
config.write(configfile)
else:
payload = {"servergroup_id": 0, "name": osDetails.nodename, "available_disk": diskSize, "available_ram": ramTotal, "cpu_speed": cpuMaxSpeed, "os_name": osName, "os_version": osVersion, "guid": pubnub.uuid}
resp = requests.put("http://cadence-bu.cloudapp.net/servers/" + config['DEFAULT']['Uuid'], data=payload, auth=("[email protected]", "Cadenc3!"))
print(resp)
pubnub.uuid = config['DEFAULT']['Uuid']
sub_thread = threading.Thread(target=subscribe)
sub_thread.start()
pulse_thread = threading.Thread(target=sendPulse)
pulse_thread.start()
print(pubnub.uuid)
print(config['DEFAULT']['UUID'])