Skip to content

dyninc/flask-weirds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask-Weirds
====================

Flask Framework (see http://flask.pocoo.org/) extension to create
web-application servers to provide WEIRDS services.

* http://datatracker.ietf.org/wg/weirds/

This extension is currently in development and does not pretend to be a
complete implementation of current state of proposals that IETF working
group is discussing.

Typical use similar to the following sudo-code:

    class ObjectModel(flask.ext.weirds.WeirdsDataModel):
        def __init__(self, name):
            self.name = find_magic_object(name)
        
        def public_data(self):
            return { 'name' : self.name}
    
    app = flask.ext.weirds.FlaskWeirdsApp(__name__)
    
    @app.route('/object/<name>')
    def object(name):
      return ObjectModel(name),


Example
--------------------

You may find bits of code similar to concepts above in the example
provided with this package "weirdsexample.py". You may create your own
WEIRDS service copying an example and adding new "data producing" code.

To run example (or your own service) you may:

* execute python script as is and use  http://localhost:5000/
  as base URI of your service (bind address 0.0.0.0:5000 is currently
  hard-coded in script)
* use WSGI application container, such as uwsgi:
  uwsgi -w weirdsexample --callable app --http 0.0.0.0:5000
  this would allow you to control more web-application runtime
  parameters

To run SSL-protected service you may use front-end Web server, either
Apache or Nginx is a simpliest choice. You may consider switching the
app to use fastcgi or uwsgi communication with frontend.


Features so far
--------------------

Idea behind this flask extension is to demonstrate that there could be
common code that might be re-used to create WEIRDS services.

There is few things it might do right now:

* presenting same data structure as JSON, mime-type application/rdap
* automatically replace relative URIs to absolute ones
 (only in "links" section so far)
* generating "extended dataset" for authorized clients
 (not yet added to an example code)



Installation
--------------------

It's not quite recommended to install this library yet because it's 
likely to be going through lots of changes in near future. Example 
is designed in a way to use current directory to be added to 
python's module search path and can be run as is. 

You may, however, use setup.py to install flask_weirds lib.

You obiously need  flask (http://flask.pocoo.org/docs/installation/) to
run this code.


License
--------------------

Copyright (c) 2012-2013, Dynamic Network Services, Inc. All rights reserved.

See the included LICENSE file for licensing information.

About

Flask extension to create WEIRDS applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages