Code Monkey home page Code Monkey logo

py-clave's Introduction

py-clave

A prototype implementation of a set of public RESTful APIs meant to enable clients to retrieve metadata and contents from a bunch of digital publications in EPUB2 format stored in free-form directory structure.

Written in Python, it is built on the tornado framework, an asynchronous non-blocking web library tuned for high performance and scalability.

The core application in /server.py implements the tornado.web.Application class, with threaded asynchronous handlers for each endpoint. It is meant to be deployed with supervisord process control system, in multiple instances listening to different ports, behind a nginx proxy. The main process is run on the default 8080 port.

On first run the server builds a sqlite3 cache of EPUB files stored in the EPUB_FILES_PATH directory (set in data.py) in order to avoid filesystem traversal on each request. The cache is then updated with a periodic callback invoked with a default interval of 120s, or an interval provided by CLI argument.

Exhaustive documentation for the implemented HTTP request may be found on the official DOCS. At the present stage the API is designed to interact with AJAX calls and does not implement any kind of UI. This may change, tho.

Licence

The source code is provided as-is under the MIT Licence. TL;DR? Do whatever you wish with it, but keep the original attribution.

Contribute

Suggestions, pull requests, issues and NOS feedback are welcome. The present code shows a few weakness, in particular the database access abstraction (or the lack of one) and could be extended in many ways, for example user authentication, alternative HTML output (care of tornado templating system?) for JSON responses when the request comes from a browser. Also, the EPUB class might be extended to comply with richer EPUB3 metadata.

py-clave's People

Contributors

atomotic avatar gabalese avatar

Watchers

 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.