Module hug

hug/init.py

Everyone needs a hug every once in a while. Even API developers. Hug aims to make developing Python driven APIs as simple as possible, but no simpler.

Hug's Design Objectives:

  • Make developing a Python driven API as succint as a written definition.
  • The framework should encourage code that self-documents.
  • It should be fast. Never should a developer feel the need to look somewhere else for performance reasons.
  • Writing tests for APIs written on-top of Hug should be easy and intuitive.
  • Magic done once, in an API, is better then pushing the problem set to the user of the API.
  • Be the basis for next generation Python APIs, embracing the latest technology.

Copyright (C) 2016 Timothy Edmund Crosley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View Source
"""hug/__init__.py

Everyone needs a hug every once in a while. Even API developers. Hug aims to make developing Python driven APIs as

simple as possible, but no simpler.

Hug's Design Objectives:

- Make developing a Python driven API as succint as a written definition.

- The framework should encourage code that self-documents.

- It should be fast. Never should a developer feel the need to look somewhere else for performance reasons.

- Writing tests for APIs written on-top of Hug should be easy and intuitive.

- Magic done once, in an API, is better then pushing the problem set to the user of the API.

- Be the basis for next generation Python APIs, embracing the latest technology.

Copyright (C) 2016  Timothy Edmund Crosley

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated

documentation files (the "Software"), to deal in the Software without restriction, including without limitation

the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and

to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or

substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED

TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF

CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR

OTHER DEALINGS IN THE SOFTWARE.

"""

from __future__ import absolute_import

from falcon import *

from hug import (

    directives,

    exceptions,

    format,

    input_format,

    introspect,

    middleware,

    output_format,

    redirect,

    route,

    test,

    transform,

    types,

    use,

    validate,

)

from hug._version import current

from hug.api import API

from hug.decorators import (

    context_factory,

    default_input_format,

    default_output_format,

    delete_context,

    directive,

    extend_api,

    middleware_class,

    reqresp_middleware,

    request_middleware,

    response_middleware,

    startup,

    wraps,

)

from hug.route import (

    call,

    cli,

    connect,

    delete,

    exception,

    get,

    get_post,

    head,

    http,

    local,

    not_found,

    object,

    options,

    patch,

    post,

    put,

    sink,

    static,

    trace,

)

from hug.types import create as type

# The following imports must be imported last; in particular, defaults to have access to all modules

from hug import authentication  # isort:skip

from hug import development_runner  # isort:skip

from hug import defaults  # isort:skip

try:  # pragma: no cover - defaulting to uvloop if it is installed

    import uvloop

    import asyncio

    asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())

except (ImportError, AttributeError):

    pass

__version__ = current

Sub-modules

Variables

COMBINED_METHODS
DEFAULT_MEDIA_TYPE
HTTP_100
HTTP_101
HTTP_102
HTTP_200
HTTP_201
HTTP_202
HTTP_203
HTTP_204
HTTP_205
HTTP_206
HTTP_207
HTTP_208
HTTP_226
HTTP_300
HTTP_301
HTTP_302
HTTP_303
HTTP_304
HTTP_305
HTTP_307
HTTP_308
HTTP_400
HTTP_401
HTTP_402
HTTP_403
HTTP_404
HTTP_405
HTTP_406
HTTP_407
HTTP_408
HTTP_409
HTTP_410
HTTP_411
HTTP_412
HTTP_413
HTTP_414
HTTP_415
HTTP_416
HTTP_417
HTTP_418
HTTP_422
HTTP_423
HTTP_424
HTTP_426
HTTP_428
HTTP_429
HTTP_431
HTTP_451
HTTP_500
HTTP_501
HTTP_502
HTTP_503
HTTP_504
HTTP_505
HTTP_507
HTTP_508
HTTP_511
HTTP_701
HTTP_702
HTTP_703
HTTP_710
HTTP_711
HTTP_712
HTTP_719
HTTP_720
HTTP_721
HTTP_722
HTTP_723
HTTP_724
HTTP_725
HTTP_726
HTTP_727
HTTP_740
HTTP_741
HTTP_742
HTTP_743
HTTP_744
HTTP_745
HTTP_748
HTTP_749
HTTP_750
HTTP_753
HTTP_754
HTTP_755
HTTP_759
HTTP_771
HTTP_772
HTTP_773
HTTP_774
HTTP_776
HTTP_777
HTTP_778
HTTP_779
HTTP_780
HTTP_781
HTTP_782
HTTP_783
HTTP_784
HTTP_785
HTTP_786
HTTP_791
HTTP_792
HTTP_797
HTTP_799
HTTP_ACCEPTED
HTTP_ALREADY_REPORTED
HTTP_BAD_GATEWAY
HTTP_BAD_REQUEST
HTTP_CONFLICT
HTTP_CONTINUE
HTTP_CREATED
HTTP_EXPECTATION_FAILED
HTTP_FAILED_DEPENDENCY
HTTP_FORBIDDEN
HTTP_FOUND
HTTP_GATEWAY_TIMEOUT
HTTP_GONE
HTTP_HTTP_VERSION_NOT_SUPPORTED
HTTP_IM_A_TEAPOT
HTTP_IM_USED
HTTP_INSUFFICIENT_STORAGE
HTTP_INTERNAL_SERVER_ERROR
HTTP_LENGTH_REQUIRED
HTTP_LOCKED
HTTP_LOOP_DETECTED
HTTP_METHODS
HTTP_METHOD_NOT_ALLOWED
HTTP_MOVED_PERMANENTLY
HTTP_MULTIPLE_CHOICES
HTTP_MULTI_STATUS
HTTP_NETWORK_AUTHENTICATION_REQUIRED
HTTP_NON_AUTHORITATIVE_INFORMATION
HTTP_NOT_ACCEPTABLE
HTTP_NOT_FOUND
HTTP_NOT_IMPLEMENTED
HTTP_NOT_MODIFIED
HTTP_NO_CONTENT
HTTP_OK
HTTP_PARTIAL_CONTENT
HTTP_PAYMENT_REQUIRED
HTTP_PERMANENT_REDIRECT
HTTP_PRECONDITION_FAILED
HTTP_PRECONDITION_REQUIRED
HTTP_PROCESSING
HTTP_PROXY_AUTHENTICATION_REQUIRED
HTTP_REQUESTED_RANGE_NOT_SATISFIABLE
HTTP_REQUEST_ENTITY_TOO_LARGE
HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE
HTTP_REQUEST_TIMEOUT
HTTP_REQUEST_URI_TOO_LONG
HTTP_RESET_CONTENT
HTTP_SEE_OTHER
HTTP_SERVICE_UNAVAILABLE
HTTP_SWITCHING_PROTOCOLS
HTTP_TEMPORARY_REDIRECT
HTTP_TOO_MANY_REQUESTS
HTTP_UNAUTHORIZED
HTTP_UNAVAILABLE_FOR_LEGAL_REASONS
HTTP_UNPROCESSABLE_ENTITY
HTTP_UNSUPPORTED_MEDIA_TYPE
HTTP_UPGRADE_REQUIRED
HTTP_USE_PROXY
MEDIA_GIF
MEDIA_HTML
MEDIA_JPEG
MEDIA_JS
MEDIA_JSON
MEDIA_MSGPACK
MEDIA_PNG
MEDIA_TEXT
MEDIA_XML
MEDIA_YAML
WEBDAV_METHODS
connect
current
delete
get
get_post
head
options
patch
post
put
trace