0

Does anyone know how to print the JSON results from the Binance's API? I've been using this to get_all_tickers which returns all symbols and prices. I want to be able to select a certain symbol and price and display it live in the terminal continuously or until the user exits. I'm using this library.

my code:

url = 'https://api.binance.com/api/v3/ticker/price'
response = reqs.get(url)        # To execute get request 
print(response.status_code)     # To print http response code  
print(response.content)
print(response.json)            # To print formatted JSON response 

output:

200 
{ 
  "userId": 1, 
  "id": 1, 
  "title": "market data", 
  "completed": False 
} 
Jason Aller
  • 3,541
  • 28
  • 38
  • 38
GRTTX
  • 1
  • 2
  • Instead of printing `response.json`, assign it to some name, then you have a regular python object – roganjosh Jun 21 '19 at 20:24
  • I'm suspicious about `response.json` instead of `response.json()` (calling the function) but maybe I'm getting muddled with Flask – roganjosh Jun 21 '19 at 20:25

0 Answers0