Total Complexity | 2 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |