Coder Social home page Coder Social logo

py-ticketserver's Introduction

This is a bare-bones ticket server that runs as a stand-alone HTTP service.

It allows applications to request a new ticket, check the status of an existing
ticket and mark a ticket as completed. It is not sexy. It does not make
ponies. It makes tickets. What you do with them is your business but presumably
you'd use to keep track of long(ish) running tasks so that clients can
periodically poll to see if they've been completed.

It uses the Shove module to provide a variety of backends for storing tickets;
as of this writing only in-memory and Amazon S3 backends are supported.

The interface looks like this:

	http://localhost:8003/get_ticket

	http://localhost:8003/check_ticket?ticket=TICKETID

	http://localhost:8003/mark_ticket_completed?ticket=TICKETID

All calls return plain text. The 'get_ticket' method returns a ticket. The check
ticket returns (UNKNOWN, PENDING, COMPLETED). The 'mark_ticket_completed' method
returns (OK, FAIL).

Ticket IDs are generated as UUIDs and, by default, are purged the first time
they are checked after having been marked as completed.

There is (currently) no authentication model. It's not expected that you'll be
running this on a public-facing host. Buyer beware.

--

# EXAMPLE (CLI usage)

$> ticketserver/__init__.py --scheme s3 --port 9999 --s3_config ~/.api/aws.cfg --s3_bucket ticketserver

# EXAMPLE (S3 config file)

[aws]
access_key=AMAZON_WEBSERVICES_ACCESSKEY
secret_key=AMAZON_WEBSERVICES_SECRETKEY

# EXAMPLE (from your code)

ts = ticketserver('s3://key:secret@bucket')

ticket = ts.get_ticket()

ts.mark_ticket_completed(ticket)

status = ts.check_ticket(ticket)

--

# IMPORTANT

This package also uses the Servable WSGI wrapper library which is great except
for the part where you will currently need to comment out line 104 of
servable.py per this thread:

http://code.google.com/p/servable/issues/detail?id=1

--

# REQUIREMENTS

http://pypi.python.org/pypi/shove
http://pypi.python.org/pypi/servable/

py-ticketserver's People

Contributors

thisisaaronland avatar

Stargazers

Angus H. avatar Aaron Straup Cope avatar

Watchers

Aaron Straup Cope 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.