You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
473 B
Python

import os
import requests
import json
import config
with requests.Session() as session:
session.auth = ('admin1', config.USER_PASS)
for obj in ['user', 'project', 'task', 'job', 'organization', 'membership',
'invitation']:
response = session.get(f'http://localhost:8080/api/v1/{obj}s?page_size=all')
with open(os.path.join(config.ASSETS_DIR, f'{obj}s.json'), 'w') as f:
json.dump(response.json(), f, indent=2, sort_keys=True)