Skip to content

Commit fc99e23

Browse files
Make dummy students for testing
1 parent 0e9f162 commit fc99e23

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

create_dummy_students.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from config import PROD_URL, PROD_KEY
2+
from canvasapi import Canvas
3+
4+
canvas = Canvas(EACC_URL, EACC_KEY)
5+
6+
# Run a quick loop and make some dummy students
7+
account = canvas.get_account(1)
8+
9+
for i in range(1, 5):
10+
# Create a user object
11+
user = {
12+
'name': 'Test Student ' + str(i),
13+
'terms_of_use': True,
14+
'skip_registration': True,
15+
}
16+
17+
# Update the user login info
18+
pseudonym = {
19+
'unique_id': 'tstudent' + str(i),
20+
'password': 'tstudent' + str(i),
21+
'send_confirmation': False,
22+
}
23+
24+
try:
25+
account.create_user(pseudonym, user=user)
26+
print(f'Successfully created {user['name']}')
27+
except Exception as e:
28+
print(e)
29+
30+

0 commit comments

Comments
 (0)