import random
import string


def request(module: str, **kwargs):
    """Format cookies and data to make a request to the Wikidot API"""

    token = ''.join(
        random.choices(string.ascii_lowercase + string.digits, k=6)
    )
    cookies = {'wikidot_token7': token}
    data = {
        'callbackIndex': '1',
        'wikidot_token7': token,
        'moduleName': module,
        **dict([a, str(x)] for a, x in kwargs.items())
    }

    return data, cookies