Please note: Friday June 18 is a holiday celebrating Juneteenth, please allow extra time for your order to arrive and plan accordingly.
0

Libraries needed to get data from URL
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Libraries needed to get data from URL

by DeltaGear on Wed Jun 02, 2021 9:56 pm

Hello,

I'm trying to modify the Bitcoin Value RGB Matrix Display Project. I have the whole project up and running. But I'm looking to do a bit more. Specifically, I want to know how to get request json data from a url, but I cannot find the proper command or library to use. Granted, I'm very new to circuit python and couldn't find a clear answer in the documentation.

Basically, I'm looking for help doing the following, and what libraries I need to include.
Code: Select all | TOGGLE FULL SIZE
url = www.url.com/json

response = requests.get(url)
json_data = response.json
value = jason_data["bitcoin", "usd_24h_change"]



The project seems to use from the Matrix Portal library, which does a bunch of things with an LED display as it gets data from the url. I'm ideally looking for a standalone command.

DeltaGear
 
Posts: 1
Joined: Wed Jun 02, 2021 9:44 pm

Re: Libraries needed to get data from URL

by adafruit_support_mike on Thu Jun 03, 2021 8:38 pm

There's no specific library, but you can use the .rsplit() function to break a URL into pieces:

https://circuitpython.readthedocs.io/en ... egex.split

Then you can look at the components as individual strings to decide what to do.

adafruit_support_mike
 
Posts: 62799
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.