How to issue a token with Python client

The issue we like raise is the following.

We like to issue a token with a Python client to SOLID. We managed to get access using a cookie, however, we like to issue a token to get access to our SOLID account.

This issue mentioned two types of authentication, other than cooking: tokens and certificates.

How can we issue a token in Python?

Our code so far:

    import requests
    import re
    login_params = {
        'username': '<user>',
        'password': '<pass>'
    r       ='https://<user>',login_params)
    str_res = r.text
    r       = requests.get('https://<user>', cookies=r.cookies)
    str_res = r.text