Giter Site home page Giter Site logo

devdave / txweb Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 0.0 586 KB

An alternative routing system for twisted.web that is backwards compatible

Home Page: http://ominian.com/2011/07/29/txweb-alpha-a-different-spin-on-twisted-web/

License: MIT License

Python 94.67% Batchfile 0.75% Makefile 0.37% HTML 0.17% JavaScript 4.03%

txweb's Introduction

Twisted Web extension

A routing extension to twisted.web

Status

Super beta

Major issues

Error handling still needs to be improved/refactored

Purpose & History

This project started a few months around when Klein did and if you want a more complete web framework I would recommend that over txWeb.

TxWeb is an overlay above the twisted.web module/package along with providing a routing resource mechanism.

from twisted.internet import reactor

from txweb import Application



app = Application(__name__)

@app.route("/hello")
def provide_hello(request):
    return "Hello World"


@app.route("/args")
def provide_arguments(request):
    who = request.args.get("who", default="No body")
    says = request.args.get("says", default="Nothing")
    #Python 3.8
    return f"{who} said {says}"
# would output "DevDave said Hello" given /args?who=DevDave&says=Hello
# would output "No body said Nothing" give /args

@app.route("/process_form")
def handle_form(request):
    input1 = request.form.get("input1")
    return ""

app.listenTCP(8080)
reactor.run() 
 

Also, please refer to the example's directory (but not to_replace or to_update sub-dirs) for slightly more filled out examples of use.

txweb's People

Contributors

devdave avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.