hosting the python script for STEEM SBD TICKER for @getlametric time - understand the script and a great host for only $5 a month [v2]

in lametric •  7 years ago 

today I want to tell you a little bit more about the script that I’ve got running (had help by @emrebeyler to get it running) for my lametric device that dayle bought me for christmas, while these things are not cheap I really love the idea that you can develop easily for them and that you can string them together for a longer scrolling panel, I’d love another three of them to really see that effect, that’s when scrolling would really be neat.

so then the script, after running the script manually it goes away to grab the coincapmarket information and updates the device via their api, it’s a manual process running on my local machine, obviously I want to automate that so it updates ideally every minute to keep everything up to date, I could probably go even more regular than that but for now I think sixty seconds is enough — I therefore need a python host that can host that simple script for me without any of the other usual stuff to worry about.

Step forward then pythonanywhere a super powerful but simple service that offers the ability to host your python based scripts — I didn’t want to be worrying about managing a full on cloud instance I just wanted to have a service that did one thing and did it well, these guys seem to be perfect with a great dashboard, consoles, file manager, web hosting and most importantly tasks — out of the box it was blocking the access on the free account to the lametric api but they whitelisted the access to it so I can see it working on the free account, that’s great customer service.

Right now on the free account I can run that script daily but for $5 a month I can run it how often I want, ideally it’s going to be in minutes and the best thing is that I should be able to easily duplicate the script to pull in the steem price as well, build another frame on the display of the lametric device and have them cycle between the prices — that’s pretty rad right? :)

the price ticker code for lametric time

I’ve included a copy of the really simple script below, I’m not a coder so the notes are for me and I realise that parts of the error code are a bit clunky if they don’t bring back that result, that it drops through and prints the message regardless, like I’ve said before i’m not a coder so all of this is a learning curve for me.

Again, thank you to @emrebeyler who helped out take my basic lookup api call and turning it into something useable, steem is really amazing that I can blog about that and wishing three hours someone jumped in and wanted to help me get up and running, it’s certainly pushing me to take a course this year in some coding even thou I’m not really a coder or have ever been interested in making things on the backend side.


# url starting with https://developer.lametric.com/api/v1
# remember every publish you get a new URL and TOKEN (also check the icon if you change that and frames)
URL = "https://developer.lametric.com/api/v1/<your-url-here>"

# access token
ACCESS_TOKEN = "the-access-token-for-the-app"

def push_price():
    data = requests.get(
        "https://api.coinmarketcap.com/v1/ticker/steem-dollars/").json()

    headers = {
        'Accept': 'application/json',
        'X-Access-Token': ACCESS_TOKEN,
        'Cache-Control': 'no-cache',
    }

    r = requests.post(URL, json={
        "frames": [{
            "text": data[0]["price_usd"],
            "icon": "a16407",
            "index": 0
        }]
    }, headers=headers)

    if r.status_code == '200':
        print("Sent!")
    else:
        print("- steemit.com/@teamhumble")
        print(r.text)


push_price()

next things to do with the script

I’m going to duplicate this and grab the steem price and build another frame in the app maker which is part of the lametric website, it changes the code so I’ll have to change the code in the script to make sure that it’s receiving the correct information because of the second panel (which will effect the first script as well) and ideally I’d like to have the two scripts build into one, I’m wondering if I can just make another def array and then call it the same way, something to play with anyway — oh also, I’ll be making the application then public instead of private because the script will be hosted in the cloud so everyone with a lametric will be able to check the price of steem and sbd too ;) — pretty neat.

i was thinking of recording a video or audio next time to step you through all the parts if anyone is interested in that? it means setting up my tabs and explaining things as non-techy as possible but i thought it might be interesting to those people that might want to learn alongside with me?

TRUST AND AUTHENTICATION. .

http://socialgandalf.com/legacypinterest epic wins pinboard → i was a brand advocate for nokia, 1000heads, verisign → won a vloggie for involvement in node666 (san francisco 2006) → on television for time team history hunters 1999 (burton on trent) → sold me.dm to evan williams (twitter) in april 2011 for 5 figures → went to phil campbell, alabama to help repair/recovery/help raise money month after a tornado ripped through the town (was on sky news, bbc news, al jazeeza, nightly news, alabama weather channel?!) → CNN for sxsw 2013 about austin south by southwest event → video chat with robert scoble from rackspace → i was in a music video can you spot me? → won the digital derry contest for 5k euros to kickstart web tv studio → did project work with sleepydog indirectly for nesta (responder) → crowdfunded digital signage concept called the pi street (do it for steem?)

☂ᗴᗩᙢᖺᘮᙢᕊᒪᗴ
together we win

@teamhumble - general blogposts
@teamaudio - decentralized audio on dtube
@teamvideo - decentralized video & tutorials
@nomadpictures - pics and snaps from the road
@bansko - co-working basecamp
@cinemagraph - free and paid cinemagraphs
@eresidency - information for estonian e-residency
@everydaycarry - steemians every day carry
@vlogging - day to day vlogging videos
@texttosteem - text to audio services

» TWEET ME «
» YOUTUBES «
» INSTARARA «
» PODCAST «
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

wow, Pythonanywhere looks neat. Never heard of it before.

Congrats for the progress. :)

right, cool little services. wanna work together again soon? cheers!

Happy to help.

That's really cool! I'd like to put one of those on my desk lol

yeah they work pretty great.

maybe if i had money i would give it a try

well sure, that's like anything in life right? :) i was given this as a gift. it works great.

YAS! Love being able to see the price of SBD without opening an app anywhere, BAM it's there!

i like your all post... i wish you alwys..thank you