Skip to main content

Tornado Async Utilities

Project description

Maintained license PythonVersions status PyPI Requirements Status Build Status Coverage Status

tor-async-util is a set of utilities that are useful when implementing RESTful APIs using Tornado’s Asynchronous and non-Blocking I/O.

Features

  • when async curl httpclient is used, it’s useful to know if libcurl was compiled with an async dns resolver - see is_libcurl_compiled_with_async_dns_resolver()

  • instead of CTRL+C generating an unfriendly stack trace install a signal handler - see install_sigint_handler()

  • a default request handler which generates a RESTful API friendly not found response - see DefaultRequestHandler()

  • an abstract base class from which all request handler classes can be derived to provide

  • read and write json requests and responses optionally verifying each against a jsonschema - see RequestHandler.get_json_request_body() and RequestHandler.write_and_verify()

  • accessing decoded BASIC auth credentials - see RequestHandler.get_basic_auth_creds()

  • augment Tornado’s default set_status() with support for additional status codes - see RequestHandler.set_status()

  • override Tornado’s default write_error() so a json response body is generated rather than the default HTML response body - see RequestHandler.write_error()

  • thin wrapper around ConfigParser.ConfigParser to parse ini files for things settings such as logging levels, keyczar crypters and keyczar signers - see Config

  • core implementations of /_version, /_noop and /_health endpoints include async health checkers - see generate_version_response(), generate_noop_response(), generate_health_check_response() and AsyncHealthCheck

  • this explains that the time_info attribute of a tornado response object contains timing details of the phases of a request which is available when using the cURL http client. a description of these timing details can be found at here. these timings are very, very helpful in understanding latencies from interactions between microservices - see write_http_client_response_to_log(). an example of what the logs look like is below

2016-01-23T03:45:53.362+00:00 INFO async_docker_remote_api 'Remote Docker API' took 3.42 ms to
respond with 200 to 'GET' against >>>http://127.0.0.1:4243/containers/cid/logs?stdout=1<<< - timing
detail: q=0.13 ms n=0.03 ms c=0.04 ms p=1.65 ms s=1.66 ms t=1.83 ms r=0.00 ms
  • integration tests often run database installer(s), start up service(s) and then direct various requests at the service(s). when the tests fail it’s very useful to output the logs associated with the installers and services. The nose plug-in tor_async_util.nose_plugins.FileCapture is used in integration tests to identify the files that should be displayed on test failure. in order for tor_async_util.nose_plugins.FileCapture to work as desired it must be registered prior to running tests. tor_async_util_nosetests.py is responsible for registering tor_async_util.nose_plugins.FileCapture and is as a replacement for nosetests as per the instructions documented here

Project details


Download files

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

Source Distribution

tor_async_util-1.14.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

tor_async_util-1.14.0-py2-none-any.whl (18.1 kB view details)

Uploaded Python 2

File details

Details for the file tor_async_util-1.14.0.tar.gz.

File metadata

File hashes

Hashes for tor_async_util-1.14.0.tar.gz
Algorithm Hash digest
SHA256 d225c979b41410c647786bff9c5a509ae6b01a7009653a784e90f31cf9886777
MD5 a5627f9d975cb5963f2194f51f80998b
BLAKE2b-256 f9fc45b3cd8b31b676d9df6ae3320d746d4018e4dca5ae9c9ae7ac9da7511204

See more details on using hashes here.

File details

Details for the file tor_async_util-1.14.0-py2-none-any.whl.

File metadata

File hashes

Hashes for tor_async_util-1.14.0-py2-none-any.whl
Algorithm Hash digest
SHA256 309ba6970cb5fc2cea5d8b00101bf4bfac0ef01094acd9d2f21b02894a9ac9a8
MD5 5000e2e2ca03fffeeac912becbbbcc87
BLAKE2b-256 f204ace9adf22554fb4d1b4d5397a4f9f0a877742ecdc745dafe3875c8196769

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page