Writing data to channel using urllib python package

Hello,
I am trying to write instrument data to a ThingSpeak channel using python. I have installed the urllib package and I am using using the urlopen command to write data. I am able to write data for multiple fields (I have shown t1 as an example but I also have t2, t3), however the rate is inconsistent. More explicitly, the time in between data points varies. I have tried different length delays between events, still inconsistent.
Is this because of Thingspeak, or my python script?
c1 = 'https://api.thingspeak.com/update?api_key=__________&field4='
t1 = urllib.urlopen(c1+str(temp4))
t1.close()
sleep(30)

댓글 수: 3

Are you updating each field separately?
Note that each channel can be updated at most once per second (with a paid ThingSpeak license), or once every 15 seconds (with a free license). So, if updating of the different fields in a channel is one field at a time without sufficient delays between each, only some updates will be accepted.
PS: Please do not post write API keys in your code public. These can then be used to update your channel with spurious data. I'd strongly recommend reseting the write API key in your channel.
Ok thank you for the info! I did not know about the 15 second delay, I have been using 30 second delays as a standard so I assume that would not be the issue.
If you've resolved that, then another reason your rate is incosistent could be device being capacity limited. Are you sure your computer/device running the python code is not being capacity limited (CPU, memory, network bandwidth, etc.) and is not going to sleep?

댓글을 달려면 로그인하십시오.

답변 (0개)

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

도움말 센터File Exchange에서 Write Data to Channel에 대해 자세히 알아보기

제품

질문:

2019년 11월 5일

댓글:

2019년 11월 5일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by