@@ -79,7 +79,7 @@ def sync_challenge(challenge, ignore=[]):
79
79
# Create new flags
80
80
if challenge .get ("flags" ) and "flags" not in ignore :
81
81
# Delete existing flags
82
- current_flags = s .get (f "/api/v1/flags" , json = data ).json ()["data" ]
82
+ current_flags = s .get ("/api/v1/flags" , json = data ).json ()["data" ]
83
83
for flag in current_flags :
84
84
if flag ["challenge_id" ] == challenge_id :
85
85
flag_id = flag ["id" ]
@@ -88,11 +88,11 @@ def sync_challenge(challenge, ignore=[]):
88
88
for flag in challenge ["flags" ]:
89
89
if type (flag ) == str :
90
90
data = {"content" : flag , "type" : "static" , "challenge_id" : challenge_id }
91
- r = s .post (f "/api/v1/flags" , json = data )
91
+ r = s .post ("/api/v1/flags" , json = data )
92
92
r .raise_for_status ()
93
93
elif type (flag ) == dict :
94
94
flag ["challenge_id" ] = challenge_id
95
- r = s .post (f "/api/v1/flags" , json = flag )
95
+ r = s .post ("/api/v1/flags" , json = flag )
96
96
r .raise_for_status ()
97
97
98
98
# Update topics
@@ -110,7 +110,7 @@ def sync_challenge(challenge, ignore=[]):
110
110
# Add new challenge topics
111
111
for topic in challenge ["topics" ]:
112
112
r = s .post (
113
- f "/api/v1/topics" ,
113
+ "/api/v1/topics" ,
114
114
json = {
115
115
"value" : topic ,
116
116
"type" : "challenge" ,
@@ -122,22 +122,22 @@ def sync_challenge(challenge, ignore=[]):
122
122
# Update tags
123
123
if challenge .get ("tags" ) and "tags" not in ignore :
124
124
# Delete existing tags
125
- current_tags = s .get (f "/api/v1/tags" , json = data ).json ()["data" ]
125
+ current_tags = s .get ("/api/v1/tags" , json = data ).json ()["data" ]
126
126
for tag in current_tags :
127
127
if tag ["challenge_id" ] == challenge_id :
128
128
tag_id = tag ["id" ]
129
129
r = s .delete (f"/api/v1/tags/{ tag_id } " , json = True )
130
130
r .raise_for_status ()
131
131
for tag in challenge ["tags" ]:
132
132
r = s .post (
133
- f "/api/v1/tags" , json = {"challenge_id" : challenge_id , "value" : tag }
133
+ "/api/v1/tags" , json = {"challenge_id" : challenge_id , "value" : tag }
134
134
)
135
135
r .raise_for_status ()
136
136
137
137
# Upload files
138
138
if challenge .get ("files" ) and "files" not in ignore :
139
139
# Delete existing files
140
- all_current_files = s .get (f "/api/v1/files?type=challenge" , json = data ).json ()[
140
+ all_current_files = s .get ("/api/v1/files?type=challenge" , json = data ).json ()[
141
141
"data"
142
142
]
143
143
for f in all_current_files :
@@ -158,13 +158,13 @@ def sync_challenge(challenge, ignore=[]):
158
158
159
159
data = {"challenge_id" : challenge_id , "type" : "challenge" }
160
160
# Specifically use data= here instead of json= to send multipart/form-data
161
- r = s .post (f "/api/v1/files" , files = files , data = data )
161
+ r = s .post ("/api/v1/files" , files = files , data = data )
162
162
r .raise_for_status ()
163
163
164
164
# Create hints
165
165
if challenge .get ("hints" ) and "hints" not in ignore :
166
166
# Delete existing hints
167
- current_hints = s .get (f "/api/v1/hints" , json = data ).json ()["data" ]
167
+ current_hints = s .get ("/api/v1/hints" , json = data ).json ()["data" ]
168
168
for hint in current_hints :
169
169
if hint ["challenge_id" ] == challenge_id :
170
170
hint_id = hint ["id" ]
@@ -181,7 +181,7 @@ def sync_challenge(challenge, ignore=[]):
181
181
"challenge_id" : challenge_id ,
182
182
}
183
183
184
- r = s .post (f "/api/v1/hints" , json = data )
184
+ r = s .post ("/api/v1/hints" , json = data )
185
185
r .raise_for_status ()
186
186
187
187
# Update requirements
@@ -246,18 +246,18 @@ def create_challenge(challenge, ignore=[]):
246
246
for flag in challenge ["flags" ]:
247
247
if type (flag ) == str :
248
248
data = {"content" : flag , "type" : "static" , "challenge_id" : challenge_id }
249
- r = s .post (f "/api/v1/flags" , json = data )
249
+ r = s .post ("/api/v1/flags" , json = data )
250
250
r .raise_for_status ()
251
251
elif type (flag ) == dict :
252
252
flag ["challenge" ] = challenge_id
253
- r = s .post (f "/api/v1/flags" , json = flag )
253
+ r = s .post ("/api/v1/flags" , json = flag )
254
254
r .raise_for_status ()
255
255
256
256
# Create topics
257
257
if challenge .get ("topics" ) and "topics" not in ignore :
258
258
for topic in challenge ["topics" ]:
259
259
r = s .post (
260
- f "/api/v1/topics" ,
260
+ "/api/v1/topics" ,
261
261
json = {
262
262
"value" : topic ,
263
263
"type" : "challenge" ,
@@ -270,7 +270,7 @@ def create_challenge(challenge, ignore=[]):
270
270
if challenge .get ("tags" ) and "tags" not in ignore :
271
271
for tag in challenge ["tags" ]:
272
272
r = s .post (
273
- f "/api/v1/tags" , json = {"challenge_id" : challenge_id , "value" : tag }
273
+ "/api/v1/tags" , json = {"challenge_id" : challenge_id , "value" : tag }
274
274
)
275
275
r .raise_for_status ()
276
276
@@ -288,7 +288,7 @@ def create_challenge(challenge, ignore=[]):
288
288
289
289
data = {"challenge_id" : challenge_id , "type" : "challenge" }
290
290
# Specifically use data= here instead of json= to send multipart/form-data
291
- r = s .post (f "/api/v1/files" , files = files , data = data )
291
+ r = s .post ("/api/v1/files" , files = files , data = data )
292
292
r .raise_for_status ()
293
293
294
294
# Add hints
@@ -303,7 +303,7 @@ def create_challenge(challenge, ignore=[]):
303
303
"challenge_id" : challenge_id ,
304
304
}
305
305
306
- r = s .post (f "/api/v1/hints" , json = data )
306
+ r = s .post ("/api/v1/hints" , json = data )
307
307
r .raise_for_status ()
308
308
309
309
# Add requirements
0 commit comments