import json

import requests


def main():
    client = requests.session()
    client.get("http://localhost:8000/")

    client.post(
        "http://localhost:8000/api/core/login/",
        json={
            "username": "admin",
            "password": "test",
        },
    )

    response = client.get(
        "http://localhost:8000/api/course/page/test-lehrgang-lp/",
    )
    print(response.status_code)
    print(response.json())

    with open("learning_path_json.json", "w") as f:
        f.write(json.dumps(response.json(), indent=4))


if __name__ == "__main__":
    main()
