I'm trying to call multiple (more than 10 urls) at a time and save all those 10 url's data, which will be in json format and trying to save in my location
here is the below code I have tried, using this I can only achieve to get only last URL's data saved in my json file. How to get all URL's data and stored in a single json file?
import json
import requests
URLs = ['http://httpbin.org/ip',
'http://httpbin.org/user-agent',
'http://httpbin.org/headers']
json_list = []
for url in URLs:
data = requests.get(url)
resolvedwo = data.json()
with open('resolvedworesolution.json', 'w') as f:
json.dump(resolvedwo, f)