1234567891011121314151617181920212223 |
- # -*- coding: utf-8 -*-
- import json
- import requests
- def query_equipment_info():
- url = 'http://api.sagacloud.cn/pythonserver/equipment_parameter_access/get_equipname_paramname/'
- response = requests.get(url, timeout=30)
- return response.json()
- def write_info(info):
- with open('equipment_info.json', 'wt') as f:
- json.dump(info.get('equipment_and_parameter'), f, ensure_ascii=False)
- print('Wrote to json file')
- if __name__ == '__main__':
- write_info(query_equipment_info())
|