Log status codes when initializing actor

This commit is contained in:
wvffle 2022-07-02 10:44:12 +00:00
parent c1cecd45a4
commit 8cf98afe0b
2 changed files with 6 additions and 4 deletions

View File

@ -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

View File

@ -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')
res = req.get('http://localhost:8000/api/v1/libraries/?scope=me')
print(res.status_code)