# Standard library

# I'm storing this here for the moment because I'm not sure where else to store it.

raise Exception("Remove this line and update 27-35 with data about the new devel release.")

import os
from http.cookiejar import MozillaCookieJar

# Local
from macaroonbakery import httpbakery


def authentication(request, payload):
    url = 'https://ubuntu.com/security/releases'

    client = httpbakery.Client(cookies=MozillaCookieJar(".login"))

    if os.path.exists(client.cookies.filename):
        client.cookies.load(ignore_discard=True)

    response = client.request(request, url=url, json=payload)
    client.cookies.save(ignore_discard=True)
    print(response, response.text)


release = {
    "name": "Hirsute Hippo",
    "version": "21.04",
    "codename": "hirsute",
    "lts": "False",
    "development": "True",
    "release_date": "2021-04-22",
    "esm_expires": "2022-01-31",
    "support_expires": "2022-01-31",
}

authentication("POST", release)
