How can i resolve problem in Python?
This is the code, that will help you to get what you want
Note: you will need to install
requests
library before running the code.pip install requests
import json
import requests
with open("/data/python/config.json", "r") as f:
config = json.load(f)
result = requests.get(config['url'])
config['content'] = result.text[:15]
with open("config.json", "w") as f:
json.dump(config, f)
It does simple things:
config.json
from json to python dicturl
value from itrequests
librarycontent
config.json