import requests def exos(nb, username, password): rr = requests.post('http://localhost:8002/register', data={"username": username, 'password': password, 'password_confirm': password}) token = rr.json()['access_token'] for i in range(nb): r = requests.post('http://localhost:8002/exercices', data={"name": "Test" + str(i), "consigne": "consigne", "private": False}, files={ 'file': ('test.py', open('./tests/testing_exo_source/exo_source.py', 'rb'))}, headers={"Authorization": "Bearer " + token}) exos(100, "lilianTest2", "Pomme937342")