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


Python Pubnub.uuid方法代码示例

本文整理汇总了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
开发者ID:AleksyDudek,项目名称:pubnub-api,代码行数:30,代码来源:uuid-example.py

示例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'])
开发者ID:CWFranklin,项目名称:cadence-py-host,代码行数:33,代码来源:main.py


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