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


Python Client.receive_time方法代码示例

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


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

示例1: Client

# 需要导入模块: from Adafruit_IO import Client [as 别名]
# 或者: from Adafruit_IO.Client import receive_time [as 别名]
"""
`time.py`
==========================================
Don't have a RTC handy and need
accurate time measurements?

Let Adafruit IO serve up real-time values
based off your device's IP-address!

Author: Brent Rubell
"""
# Import Adafruit IO REST client.
from Adafruit_IO import Client, Feed, Data, RequestError

# Set to your Adafruit IO key.
# Remember, your key is a secret,
# so make sure not to publish it when you publish this code!
ADAFRUIT_IO_KEY = 'YOUR_AIO_KEY'

# Set to your Adafruit IO username.
# (go to https://accounts.adafruit.com to find your username)
ADAFRUIT_IO_USERNAME = 'YOUR_AIO_USERNAME'

# Create an instance of the REST client.
aio = Client(ADAFRUIT_IO_USERNAME, ADAFRUIT_IO_KEY)

# Get the time from Adafruit IO
time = aio.receive_time()
# Time is returned as a `struct_time`
# https://docs.python.org/3.7/library/time.html#time.struct_time
print(time)
开发者ID:adafruit,项目名称:io-client-python,代码行数:33,代码来源:time.py


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