Exemple #1
0
def main():
    config.parse_args()
    log.setup('stripe')
    host = CONF.bind_host
    port = CONF.bind_port
    wsgi = simple_server.make_server(
        host, port, app.VersionSelectorApplication()
    )

    LOG = log.getLogger(__name__)
    LOG.info('Serving on http://%s:%s' % (host, port))
    LOG.info('Configuration:')
    CONF.log_opt_values(LOG, logging.INFO)

    try:
        wsgi.serve_forever()
    except KeyboardInterrupt:
        pass
Exemple #2
0
# See the License for the specific language governing permissions and
# limitations under the License.
"""
Middleware to replace the plain text message body of an error
response with one formatted so the client can parse it.

Based on pecan.middleware.errordocument
"""

import json
import webob
from xml import etree as et

from stripe.openstack.common import log as logging

LOG = logging.getLogger(__name__)


class ParsableErrorMiddleware(object):
    """Replace error body with something the client can parse.
    """
    def __init__(self, app):
        self.app = app

    def __call__(self, environ, start_response):
        # Request for this state, modified by replace_start_response()
        # and used when an error is being reported.
        state = {}

        def replacement_start_response(status, headers, exc_info=None):
            """Overrides the default response to make errors parsable.
Exemple #3
0
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from pecan import rest
from wsmeext import pecan as wsme_pecan

from stripe.common import schema
from stripe.openstack.common import log as logging

LOG = logging.getLogger(__name__)


class SchemasController(rest.RestController):
    """REST Controller for Schemas."""

    _custom_actions = {
        'agent': ['GET'],
        'queue': ['GET'],
        'queue_caller': ['GET'],
    }

    @wsme_pecan.wsexpose(unicode)
    def agent(self):
        """Retrieve schema for an agent."""
        json = {