STEEMGIG: Need Advice on Python Coding and Pulling Values out of this Json Coinmarketcap Array :)

in python •  7 years ago  (edited)

So i'm pulling the stock ticker api for the SBD price from coinmarketcap and while i've got it working and it's printing out i'm struggling with the next steps, the things i wanna do is the following. .. :)

  • i want to be able to get the value of price_usd
  • run script every 60 seconds in the cloud (heroku maybe?)
  • replace value in my working grep -x post file to that sbd value

trust me, it took me many hours just to get python working on my mac, right tools, working dependencies and all that stuff from research but i'm struggling now because i don't know how to properly play with this array of json i'm pulling down.

i've already setup the backend part for the app (and i'll tell you about it because it's simple when it's done -- it was a new gadget for christmas) and i can manually do the grep -x post and update values manually but now i want to automate this process so i can push the new value every sixty seconds.

if i can get this working i'll spruce it up for steem as well in another 'frame' or viewport for the device i'm sending too -- if we can get this working i'll have a bunch more work for someone to do as well, small things most of the time but useful to me and it helps me learn coding at the same time! :)

trust me to jump in head first, i'm not a coder and i don't have time to learn python from scratch so i'm hacking my way around it because i just want the result -- i'm sure their are a million ways to do this, even probably completely with grep if you are super hardcore but i'm not, i just wanted to jump in and try.

if you can help, get in touch! :)

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:  
Loading...

I'm a senior java programmer, but I've been looking to expand my horizons a bit.
If you feel like bringing me up to speed to where you're currently at, I could give this a shot. Would be a nice learning experience.

hey there, i'm sure it's super easy for a programmer. i am not one! :) if you look at the image you can see i'm doing BASIC stuff. basically i've been given a device for christmas called the 'lametric time' --- it's pretty neat and i'm using their standard curl -x post to auth and send a json structure to update the device, that works manually.

what i'm trying to do now is make a steem counter for sbd (and also steem after i get the proof of concept working) it's straight forward stuff in my mind -- spin up a heroku cloud instance, make a simple python script to grab the data, get the value from the array, rewrite the curl command to put in the value and send to the device, run script every 60 seconds like a cron job of sorts.... i spent a few hours and got this far after getting the environement up and running on my mac -- like i said, i'm not a coder but KINDA understand what i'm doing, just not to this level of understanding the json array and then using the python structure to re-write my working curl command they gave me to take the json aquired variable.

i'm all set now btw. thanks!

Cool. Glad you figured it out.

  ·  7 years ago (edited)

I'm writing a guide on exactly this stuff.
I will solve your issue in my next post.

edit: read further and realized I will not have to use the Steem-Python lib for this.
WIll not post about it, but can give it a shot.

sweet, i really need to get this going!

Are you in steemit.chat ?

i'm all set now.

thanks for post

why?

I am studying computer engineering but I am still new

I can use python in a small amount but not enough

I wish you convenience friend

I may play some more with this stuff in my time off. I have a Raspberry Pi with a display that could show me the current prices. I'll document what I do

i can grab prices. that's not a problem. i need help in formatting the json to a format i can use for a project i'll blog about :)

@emrebeyler hey, it works, does the update and pushes perfectly, i do get a printed 'Error' in the terminal after it's completed thou but i'm presuming that's just something in the status_code and maybe it's just printing error even thou it's working. pretty sweet man! :)

  ·  7 years ago Reveal Comment

bot. stop it.