Closed matt-desmarais closed 6 years ago
If you want to obtain the last created_epoch
or created_at
, you can call aio.receive(feed.key)
, which will output
Data(created_epoch=None, created_at='2018-09-25T16:35:47Z', updated_at='2018-09-25T16:35:47Z', value='2', completed_at=None, feed_id=880875, expiration='1543077347.0', position=None, id='0DZJQXVVZQBDMAV0QTCPJVBR6B', lat=None, lon=None, ele=None)
Then, access the data object properties directly: freezer.created_at '2018-09-25T16:35:47Z' freezer.created_epoch print(freezer.created_epoch) None
Thank you! I used the code below to test it and got the latest upload time. I appreciate the help!
aio = Client('user name', 'key')
feed1 = aio.receive('freezer5')
feed2 = aio.receive('freezer6')
#returns latest upload time
print("Freezer5: "+str(feed1.created_at))
print("Freezer6: "+str(feed2.created_at))
No problem! Closing...
I was hoping to use the functionality described here
What I am trying to do is to be able to return all the DATA_FIELDS from the most recent feed entry, I want to use either the created_epoch or created_at field to be able to see if my 2 (soon to be 6) IO clients have stopped uploading, they normally upload every minute.
Example
Would output the last retained entry from each feed: Freezer5: Data(created_epoch=1537685617, created_at='2018-09-23T06:53:37Z', updated_at=None, value='5.899999999999999', completed_at=None, feed_id=869316, expiration='2018-10-23T06:53:37Z', position=None, id='0DZGT0SPKF92RADE5FQ20W3GN7', lat=None, lon=None, ele=None) Freezer6: Data(created_epoch=1537685676, created_at='2018-09-23T06:53:36Z', updated_at=None, value='6.350000000000001', completed_at=None, feed_id=869316, expiration='2018-10-23T06:53:36Z', position=None, id='0DZGT1BJ2S2VDS7ZAP5N0SGBPN', lat=None, lon=None, ele=None)