How to use the httpcore.gather_reqdata function in httpcore

To help you get started, we’ve selected a few httpcore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github siebenmann / dwiki / testbench.py View on Github external
except derrors.WikiErr as e:
		die("dwiki error: "+str(e))

	env = setup_env(url)
	if options.ip6origin:
		# This format matches what the Fedora 17 lighttpd
		# puts into $REMOTE_ADDR. Your mileage may vary for
		# other web servers, although it's probably right
		# for Apache too.
		env['REMOTE_ADDR'] = "::1"
		
	if rend:
		httpcore.environSetup(env, cfg, ms, webserv, staticstore,
				      cachestore)
		env['dwiki.logger'] = None
		rdata = httpcore.gather_reqdata(env)
		if 'query' not in rdata:
			die("URL %s is not accepted by the core" % url)
		ctx = context.HTMLContext(cfg, ms, webserv, rdata)
		if cachestore:
			ctx.setvar(':_cachestore', cachestore)
		if options.prerun:
			runLimited(*(options.prerun, runrend, rend, ctx))
		op(cnt, runrend, rend, ctx)
	else:
		if options.prerun:
			runLimited(*(options.prerun, runwsgi, env, app))
		op(cnt, runwsgi, env, app)
github siebenmann / dwiki / dwiki-cat.py View on Github external
except derrors.RendErr as e:
			die(str(e))

	try:
		app, r = dwconfig.materialize(args[0], options)
		# We're one of the people who actually needs this.
		cfg, ms, webserv, staticstore, cachestore = r
	except derrors.WikiErr as e:
		die("dwiki error: "+str(e))

	env = setup_env(url)
	if rend:
		httpcore.environSetup(env, cfg, ms, webserv, staticstore,
				      cachestore)
		env['dwiki.logger'] = None
		rdata = httpcore.gather_reqdata(env)
		if 'query' not in rdata:
			die("URL %s is not accepted by the core" % url)
		ctx = context.HTMLContext(cfg, ms, webserv, rdata)
		if cachestore:
			ctx.setvar(':_cachestore', cachestore)
		runrend(rend, ctx)
	else:
		runwsgi(env, app)