Skip to main content

A responder framework to write responders to http requests

Project description

talkback

Respond with your response to requests

Use routes file to map url path to responders

See examples app in https://www.github.com/madhukumarseshadri/talkweb3

Examples of GET / POST / PUT / DELETE

Examples of managing formdata,

In the responder, self.qs is query string.

For GET / POST, form submission html forms,

use

self.processform()

in the responder to get the formdata [ url encoded or multipart or text/plain ]

After using processform, self.formdata.data is,

For GET, self.formdata.data is a dict of field names, value pairs and field name and values are python strings and percent decoded and plus sub-ed. Get the form values as shown below,

type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
type,fieldvalue,filename,content_type=self.formdata['fieldname']
#type - empty or b'f' with f denoting input is file
#fieldvalue -  contents of file as bytes or field value
#filename - name of the file if file
#content_type - content_type of file if file 

For POST, self.formdata.data - dict is byte field name value pairs if post is mutlipart/formdata For url encoding posts, default encoding is utf8 no need to provide, provide python supported encoding or none for bytes in self.processforms(encoding=None). For utf8, values are percent decoded and plus sub-ed

type,fieldvalue,filename,content_type=self.formdata.data['fieldname'] #or
type,fieldvalue,filename,content_type=self.formdata['fieldname']

For multipart/formdata with files,

type,fieldvalue,filename,content_type=self.formdata.data[b'fieldname'] or
type,fieldvalue,filename,content_type=self.formdata[b'file']
for type,fieldvalue,filename,content_type in self.formdata[b'files']:
	#input is multiple files

AJAX formdata GET and POST

GET / POST forms

See examples app

For PUT,

use self.processinput() within a responder

For DELETE

use self.processinput() within a responder

OPTIONS / HEAD / CONNECT AND TRACE for http server to manage

Examples for using session and cookies - see session.py in examples

fskeeper - keeps the sesson as file and pickles the session object to file sqlkeeper - keepes the session in the database in session table

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

talkback-1.5-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file talkback-1.5-py3-none-any.whl.

File metadata

  • Download URL: talkback-1.5-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for talkback-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f22a5135a14db84f5c456ddd20fd5247cfe2e8b847ae7507738e9381a33c9af0
MD5 532caa9b1522f7355dcd88064c828b68
BLAKE2b-256 3ce88f7d358131b20cae202f34dc1424f4d555cd10e4dbf959fe3edce1589a5f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page