S
S
slarp2020-08-27 15:16:04
Python
slarp, 2020-08-27 15:16:04

How to use JSON data from your local server?

In practical work, you need to deploy two local servers. One should store data in JSON format (I have already done this, through the bottle framework and now I have a JSON dictionary at localhost:8080/api/forecast ) how can I use it now on the 2nd local server (http.server).

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iddqda, 2020-08-27
@slarp

import requests

res = requests.get("http://localhost:8080/api/forecast")
if res.ok:
    print(res.json())
else:
    print("не шмогла")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question