La til autentikasjon i klienten

This commit is contained in:
Trygve 2022-01-21 11:58:39 +01:00
parent fe9da5ba89
commit 72fb716199
2 changed files with 5 additions and 1 deletions

4
.gitignore vendored
View File

@ -1,2 +1,6 @@
### Python ### ### Python ###
*__pycache__/ *__pycache__/
### Configs ###
camera/config.py
api/config.py

View File

@ -20,7 +20,7 @@ else:
try: try:
start = time.time() start = time.time()
img = {'image': open('latest.jpg', 'rb')} 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() end = time.time()
except Exception as e: except Exception as e:
logging.info('Feil under opplasting: {0}'.format(e)) logging.info('Feil under opplasting: {0}'.format(e))