-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.py
143 lines (137 loc) · 3.61 KB
/
data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
from studyportal.settings import SECRET_KEY
import requests
URL = "http://localhost:8005/api/v1"
departments = [
{
"title": "Computer Science and Engineering",
"abbreviation": "CSED",
"courses": [
{
"department": "Computer Science and Engineering",
"title": "Data Structures",
"code": "CSN-101",
},
{
"department": "Computer Science and Engineering",
"title": "Engineering Analysis and Design",
"code": "CSN-291",
},
],
},
{
"title": "Architecture and Planning",
"abbreviation": "ARCD",
"courses": [
{
"department": "Architecture and Planning",
"title": "Introduction to Advanced Architecture Techniques",
"code": "ARN-401",
}
],
},
]
files = [
{
"title": "test.pdf",
"driveid": "123456789",
"downloads": 0,
"size": "123545",
"code": "CSN-101",
"filetype": "tutorials",
"finalized": "True",
},
{
"title": "test.pdf",
"driveid": "123456789",
"downloads": 105,
"size": "123545",
"code": "CSN-101",
"filetype": "books",
"finalized": "True",
},
{
"title": "test.jpg",
"driveid": "123456789",
"downloads": 1000,
"size": "123545",
"code": "CSN-101",
"filetype": "notes",
"finalized": "True",
},
{
"title": "test.docx",
"driveid": "123456789",
"downloads": 251,
"size": "123545",
"code": "CSN-101",
"filetype": "exampapers",
"finalized": "True",
},
{
"title": "test.bmp",
"driveid": "123456789",
"downloads": 0,
"size": "123545",
"code": "CSN-291",
"filetype": "tutorials",
"finalized": "True",
},
{
"title": "test.pdf",
"driveid": "123456789",
"downloads": 65,
"size": "123545",
"code": "CSN-291",
"filetype": "tutorials",
"finalized": "True",
},
{
"title": "test.pdf",
"driveid": "123456789",
"downloads": 0,
"size": "123545",
"code": "ARN-401",
"filetype": "notes",
"finalized": "True",
},
{
"title": "test.pdf",
"driveid": "123456789",
"downloads": 0,
"size": "123545",
"code": "ARN-401",
"filetype": "tutorials",
"finalized": "True",
},
{
"title": "test.pdf",
"driveid": "123456789",
"downloads": 0,
"size": "123545",
"code": "CSN-291",
"filetype": "tutorials",
"finalized": "True",
},
]
user = {
"auth_id": 123456,
"username": "darkrider",
"email": "[email protected]",
"profile_image": "http://www.newdesignfile.com/postpic/2009/09/generic-user-profile_354184.png",
"role": "admin",
}
requests.post(URL + "/users", user, headers={"Authorization": "Bearer " + SECRET_KEY})
for department in departments:
requests.post(
URL + "/departments",
{"title": department["title"], "abbreviation": department["abbreviation"]},
headers={"Authorization": "Bearer " + SECRET_KEY},
)
for course in department["courses"]:
requests.post(
URL + "/courses", course, headers={"Authorization": "Bearer " + SECRET_KEY}
)
for file in files:
requests.post(
URL + "/files", file, headers={"Authorization": "Bearer " + SECRET_KEY}
)