MCPcopy
hub / github.com/ArchiveBox/ArchiveBox / form_valid

Method form_valid

archivebox/core/views.py:271–299  ·  view source on GitHub ↗
(self, form)

Source from the content-addressed store, hash-verified

269 }
270
271 def form_valid(self, form):
272 url = form.cleaned_data["url"]
273 print(f'[+] Adding URL: {url}')
274 parser = form.cleaned_data["parser"]
275 tag = form.cleaned_data["tag"]
276 depth = 0 if form.cleaned_data["depth"] == "0" else 1
277 extractors = ','.join(form.cleaned_data["archive_methods"])
278 input_kwargs = {
279 "urls": url,
280 "tag": tag,
281 "depth": depth,
282 "parser": parser,
283 "update_all": False,
284 "out_dir": OUTPUT_DIR,
285 }
286 if extractors:
287 input_kwargs.update({"extractors": extractors})
288 add_stdout = StringIO()
289 with redirect_stdout(add_stdout):
290 add(**input_kwargs)
291 print(add_stdout.getvalue())
292
293 context = self.get_context_data()
294
295 context.update({
296 "stdout": ansi_to_html(add_stdout.getvalue().strip()),
297 "form": AddLinkForm()
298 })
299 return render(template_name=self.template_name, request=self.request, context=context)
300
301
302class HealthCheckView(View):

Callers

nothing calls this directly

Calls 4

get_context_dataMethod · 0.95
AddLinkFormClass · 0.90
addFunction · 0.85
ansi_to_htmlFunction · 0.85

Tested by

no test coverage detected