Hello,
I thought this was a cool concept. So, I decided to try it, tweak it, and learn from it.
...
First, get to your python3 console on your BeagleBone Black Wireless w/ this command:
python3
Now...we need to find a unique, unidentifiable user ID for working w/ dweet.io and Python3. https://docs.python.org/3/library/uuid.html#example!
So, go to https://docs.python.org/3/library/uuid.html#uuid.uuid4 and learn how to create your unique ID.
Now...we need some source and some commands to proclaim our fame to the dweet.io world!
...
import requests, psutil, os
import time
import datetime
thing_name = "UUID"
def dweet(thing, **vals):
url = "http://dweet.io/dweet/for/{}".format(thing)
requests.post(url, params=vals)
def get_uptime():
with open("/proc/uptime", "r") as f:
raw = f.read()
seconds = float(raw.split()[0])
return seconds
while True:
uptime = get_uptime()
uptime_datetime = datetime.datetime.fromtimestamp(uptime)
uptime_datetime.strftime("%H:$M:$S")
load = psutil.cpu_percent(interval=2)
mem = psutil.virtual_memory()[2]
dweet(thing_name, uptime=uptime, cpu_load=load, memory=mem)
On line five, use the UUID you found by getting into the python command line and typing:
import uuid
uuid.uuid4()
That UUID goes where it states "UUID".
So, now we need to make our hyperlink available to the browser to start reviewing what we have completed.
First, type in:
https://dweet.io/follow/
Then, after follow, place your UUID to the right of the slash character.
Like this:
https://dweet.io/follow/UUID <--- you will have a unique UUID to place in this section of the hyperlink.
So, have fun and see what you can achieve by making this small program work to your benefit.
Seth
P.S. If you have any ideas, I would be open to listen. Yea boy!
Comments