• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemocracyClub / aggregator-api / 93f28176-d12b-44aa-8582-a03ba3be77a2

05 Dec 2023 03:31PM UTC coverage: 77.419% (-0.8%) from 78.236%
93f28176-d12b-44aa-8582-a03ba3be77a2

push

circleci

web-flow
Merge pull request #441 from DemocracyClub/self-serve-api-keys

Self-serve API keys

315 of 422 new or added lines in 17 files covered. (74.64%)

1 existing line in 1 file now uncovered.

864 of 1116 relevant lines covered (77.42%)

0.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/frontend/lambda_awsgi.py
NEW
1
import json
×
2

3
import awsgi
×
NEW
4
import django
×
NEW
5
import sentry_sdk
×
NEW
6
from django.core.management import call_command
×
UNCOV
7
from django.core.wsgi import get_wsgi_application
×
8

9
application = get_wsgi_application()
×
10

11

12
def lambda_handler(event, context):
×
13
    return awsgi.response(
×
14
        application,
15
        event,
16
        context,
17
        base64_content_types={"image/png", "image/jpeg", "image/x-icon"},
18
    )
19

20

NEW
21
def management_handler(event, context):
×
22
    """Sample pure Lambda function
23

24
    Parameters
25
    ----------
26
    event: dict, required
27
        API Gateway Lambda Proxy Input Format
28

29
        Event doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html#api-gateway-simple-proxy-for-lambda-input-format
30

31
    context: object, required
32
        Lambda Context runtime methods and attributes
33

34
        Context doc: https://docs.aws.amazon.com/lambda/latest/dg/python-context-object.html
35

36
    Returns
37
    ------
38
    API Gateway Lambda Proxy Output Format: dict
39

40
        Return doc: https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
41
    """
42

NEW
43
    cmd = event["command"]
×
NEW
44
    args = event.get("args", [])
×
45

NEW
46
    sentry_sdk.set_context("event", event)
×
47

NEW
48
    django.setup()
×
49

NEW
50
    call_command(cmd, *args)
×
51

NEW
52
    arg_str = " ".join(args)
×
NEW
53
    return {
×
54
        "statusCode": 200,
55
        "body": json.dumps(
56
            {
57
                "message": f"{cmd} {arg_str} completed",
58
            }
59
        ),
60
    }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc