Skip to main content
Restifier is a python library for creating and documenting RESTful APIs.
It includes a middleware component, a set of decorators, and a “forms” library for validating/documenting requests. The middle generates a Swagger compatible JSON specification for the APIs automatically.

Author

Jesse Lovelace jesse@hawatian.com

License

The MIT License

Usage

See tests.py for information on usage. In general, so create a payload validator construct a class like this:

class HelloMessage(Message):
    greeting = StringProperty(description="The greating.",
        validators=[regex(re.compile('^[A-Za-z]+$')), required()])

class HelloResponseMessage(Message):
    salutation = StringProperty(description="The response.")
    tags = StringProperty(repeated=True)
    request = StructuredProperty(HelloMessage)

Then decorate your handlers like this:

class HelloHandler(RequestHandler):

    @api(input=HelloMessage, output=HelloResponseMessage)
    def post(self, obj):
        return {'salutation':'You are the best.'}

Also, to auto-document, use the middleware:

routes = [
    ('/api/v1/hello', HelloHandler)
]

app = DocumentedMiddleware(
    WSGIApplication(routes),
    api_base="/api/v1",
    api_overview="This is a super important API that does a lot of stuff."
)

Download files

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

Source Distribution

restifier-1.0.4.tar.gz (15.0 kB view details)

Uploaded Source

File details

Details for the file restifier-1.0.4.tar.gz.

File metadata

  • Download URL: restifier-1.0.4.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for restifier-1.0.4.tar.gz
Algorithm Hash digest
SHA256 d8122e2a4950684358fc08b475cc5fe5799b327c4abbfdfc61820a94e8286cd0
MD5 ada643c4441f6b9fddfa7ce4fbcc1ac9
BLAKE2b-256 82be0a456fa73912ce287a05aa15aa28ae0aff8c53abbc5118900965f0b234c4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.4 This release

1 file

1.0.3

1 file

1.0.2

1 file

1.0.1

1 file

1.0.0

1 file

Supported by

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