From 72fb716199a03679cd2a1739cf3074a44195f956 Mon Sep 17 00:00:00 2001 From: Trygve Date: Fri, 21 Jan 2022 11:58:39 +0100 Subject: [PATCH] La til autentikasjon i klienten --- .gitignore | 4 ++++ camera/upload_img.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0f574e4..6508e9a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ ### Python ### *__pycache__/ + +### Configs ### +camera/config.py +api/config.py diff --git a/camera/upload_img.py b/camera/upload_img.py index b9b3ed3..8fdcceb 100644 --- a/camera/upload_img.py +++ b/camera/upload_img.py @@ -20,7 +20,7 @@ else: try: start = time.time() img = {'image': open('latest.jpg', 'rb')} - response = requests.post(config.config['uploadurl'], files=img) + response = requests.post(config.config['uploadurl'], files=img, headers={'Authorization': 'Basic ' + config.config['key']}) end = time.time() except Exception as e: logging.info('Feil under opplasting: {0}'.format(e))