コード例 #1
0
ファイル: views.py プロジェクト: TouK/vumi-go
def diamondash_api_proxy(request):
    """
    Proxies client snapshot requests to diamondash.

    NOTE: This proxy is a fallback for dev purposes only. A more sensible
    proxying solution should be used in production (eg. haproxy).
    """
    api = client.get_diamondash_api()
    _, url = request.path.split('/diamondash/api', 1)

    # TODO for the case of snapshot requests, ensure the widgets requested are
    # allowed for the given account

    try:
        response = api.raw_request(request.method, url, content=request.body)
    except client.DiamondashApiError as err:
        response = {
            'content': err.content,
            'code': err.code,
        }

    return HttpResponse(
        response['content'],
        status=response['code'],
        content_type='application/json')
コード例 #2
0
def diamondash_api_proxy(request):
    """
    Proxies client snapshot requests to diamondash.

    NOTE: This proxy is a fallback for dev purposes only. A more sensible
    proxying solution should be used in production (eg. haproxy).
    """
    api = client.get_diamondash_api()
    _, url = request.path.split('/diamondash/api', 1)

    # TODO for the case of snapshot requests, ensure the widgets requested are
    # allowed for the given account

    try:
        response = api.raw_request(request.method, url, content=request.body)
    except client.DiamondashApiError as err:
        response = {
            'content': err.content,
            'code': err.code,
        }

    return HttpResponse(response['content'],
                        status=response['code'],
                        content_type='application/json')
コード例 #3
0
ファイル: dashboard.py プロジェクト: linkedinyou/vumi-go
 def __init__(self, name, layout):
     self.diamondash_api = client.get_diamondash_api()
     self.name = name
     self.layout = layout
     self.config = None