ore.management.commands.test_apikey   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 18
dl 0
loc 22
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A Command.handle() 0 13 2
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