pytest-api/apiclient/demo.py

23 lines
567 B
Python
Raw Permalink Normal View History

2024-07-20 10:47:11 +00:00
import json
2024-07-22 18:26:27 +00:00
2024-07-20 10:47:11 +00:00
from apiclient.client import api_client
2024-07-22 18:26:27 +00:00
from apiclient.config import get_cfg
2024-07-20 10:47:11 +00:00
from apiclient.oauth_helper import get_legacy_token
ENV = 'qa'
cfg = get_cfg(ENV)
if __name__ == "__main__":
token = get_legacy_token(ENV)
api_call = {
"token": token,
"method": "GET",
"url": cfg["api_url"] + '/data-delivery/role',
"headers": {'Content-Type': 'application/json'},
"body": {"application_id": 1}
}
api_response = api_client(api_call)
print(json.dumps(api_response, indent=4))