From 8cf98afe0bd8aa639f9091e9ad0e9a205957b718 Mon Sep 17 00:00:00 2001 From: wvffle Date: Sat, 2 Jul 2022 10:44:12 +0000 Subject: [PATCH] Log status codes when initializing actor --- .gitpod.yml | 3 +-- .gitpod/init_actor.py | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index a23993ab5..f2d328c66 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -36,14 +36,13 @@ tasks: # Login with cURL to create actors docker-compose up -d nginx gp ports await 8000 - sleep 10 - python .gitpod/init_actor.py # Import music git clone https://dev.funkwhale.audio/funkwhale/catalog.git sudo mv catalog/music data sudo chown -R root:root data/music rm -rf catalog + python .gitpod/init_actor.py LIBRARY_ID=`cat .gitpod/create_library.py | docker-compose run --rm -T api python manage.py shell -i python` docker-compose run --rm api python manage.py import_files $LIBRARY_ID "/music/" --recursive --noinput --in-place docker-compose stop diff --git a/.gitpod/init_actor.py b/.gitpod/init_actor.py index 72e3a97e8..b6f49af61 100644 --- a/.gitpod/init_actor.py +++ b/.gitpod/init_actor.py @@ -4,14 +4,17 @@ import requests req = requests.Session() res = req.get('http://localhost:8000/login') +print(res.status_code, res.cookies) token = res.cookies['csrftoken'] -req.post('http://localhost:8000/api/v1/users/login', data={ +res = req.post('http://localhost:8000/api/v1/users/login', data={ 'username': 'gitpod', 'password': 'gitpod' }, headers={ 'Referer': 'http://localhost:8000/login', 'X-CSRFTOKEN': token }) +print(res.status_code) -req.get('http://localhost:8000') \ No newline at end of file +res = req.get('http://localhost:8000/api/v1/libraries/?scope=me') +print(res.status_code) \ No newline at end of file