Command.handle()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 13
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 13
rs 9.8
c 0
b 0
f 0
cc 2
nop 3
1
from django.core.management.base import BaseCommand
2
import requests
3
4
5
class Command(BaseCommand):
6
    args = "<API key>"
7
    help = 'Test implementation of an app client, based on the API key.'
8
9
    def handle(self, *args, **options):
10
        server = "http://192.168.33.10:8000"
11
        r = requests.get(
12
            server +
13
            '/api/v1/graph/1/?format=tex',
14
            headers={
15
                'Authorization': 'ApiKey admin:' +
16
                args[0]})
17
        print r.request.headers
18
        if r.status_code != 200:
19
            print("Error: <%u>" % r.status_code)
20
        else:
21
            print r.text
22