generateur_v3/backend/api/exo.py
2023-02-23 17:11:57 +01:00

12 lines
612 B
Python

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})
print('DONE')
exos(100, "lilianTest2", "Pomme937342")