In [26]:
import requests
dweet.io is a simple cloud which could accept data via requests.
In [27]:
payload={'Temperature':'28.1'}
In [28]:
req=requests.get('https://dweet.io/dweet/for/JunTest1?',params=payload)
In [29]:
print(req.content)
Or using dweepy lib
In [30]:
import dweepy
In [31]:
data={'Temperature':'29.1'}
In [32]:
dweepy.dweet_for('JunTest1', data)
Out[32]:
Both ways are ok. And the website to watch data is https://dweet.io/follow/JunTest1
In [41]:
import random
import time
In [42]:
for i in range(100):
data['Temperature']=random.randint(0,100)
dweepy.dweet_for('JunTest1',data)
time.sleep(2)
The following website could fetch data from long term storage of dweet.io
In [44]:
req=requests.get('https://dweet.io/get/dweets/for/JunTest1')
In [45]:
print(req.content)
In [ ]: