Skip to content

Set default user-agent with giving option to override it #417

Set default user-agent with giving option to override it

Set default user-agent with giving option to override it #417

Workflow file for this run

name: ci
on:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.7", "3.10"]
steps:
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Install main
run: |
pip install .
- name: Flake8
run: |
pip install flake8
flake8 .
- name: isort
run: |
pip install isort
isort --check .
- name: Black
run: |
pip install black
black --check .
- name: Mypy
run: |
pip install mypy
mypy --install-types --non-interactive --ignore-missing-imports -p gdown
- name: Test with pytest
run: |
pip install pytest
pytest tests
- name: Download from URL other than Gdrive
run: |
output=/tmp/gdown_r
gdown https://raw.githubusercontent.com/wkentaro/gdown/3.1.0/gdown/__init__.py -O $output --quiet
test $(md5sum $output | awk '{print $1}') = 2a51927dde6b146ce56b4d89ebbb5268
rm -rf $output
- name: Download small file from Google Drive
run: |
output=/tmp/spam.txt
success=0
while read -r file_id
do
gdown $file_id -O $output --quiet || continue
test $(cat $output) = spam && success=1 && break
done < tests/data/file_ids.csv
test $success = 1
rm -rf $output
- name: Download large file from Google Drive
run: |
output=/tmp/large_file
success=0
while IFS=, read -r file_id md5
do
gdown $file_id -O $output --quiet || continue
test $(md5sum $output | awk '{print $1}') = $md5 && success=1 && break
done < tests/data/file_ids_large.csv
test $success = 1
rm -rf $output
- name: Download and extract
run: |
gdown https://github.com/wkentaro/gdown/archive/refs/tags/v4.0.0.tar.gz -O - --quiet | tar zxf -
test -d gdown-4.0.0
- name: Download folder from Google Drive
run: |
output=/tmp/folder/
success=0
while IFS=, read -r folder_id md5
do
gdown $folder_id -O $output --quiet --folder || continue
actual_hash=$(find $output -type f -exec md5sum {} \; | awk '{print $1}' | sort | md5sum | awk '{print $1}')
test $actual_hash = $md5 || echo "$folder_id, $actual_hash" && success=1 && break
done < tests/data/folder_ids.csv
test $success = 1
rm -rf $output
- name: Try to download a folder with a file count more than the limit from Google Drive, without remaining ok
run: |
output=/tmp/folder-limit/
gdown https://drive.google.com/drive/folders/1gd3xLkmjT8IckN6WtMbyFZvLR4exRIkn -O $output --quiet --folder && exit 1 || exit 0
- name: Download docs from Google Drive
run: |
output=/tmp/file.txt
file_id=1TFYNzuZJTgNGzGmjraZ58ZVOh9_YoKeBnU-opWgXQL4
md5=6c17d87d3d01405ac5c9bb65ee2d2fc2
gdown $file_id -O $output --quiet --format txt
actual_hash=$(md5sum $output | awk '{print $1}')
test $actual_hash = $md5
- name: Download spreadsheets from Google Drive
run: |
output=/tmp/file.pdf
file_id=1h6wQX7ATSJDOSWFEjHPmv_nukJzZD_zZ30Jvy6XNiTE
md5=5be20dd8a23afa06365714edc24856f3
gdown $file_id -O $output --quiet --format pdf
actual_hash=$(md5sum $output | awk '{print $1}')
test $actual_hash = $md5
- name: Download slides from Google Drive
run: |
output=/tmp/file.pdf
file_id=13AhW1Z1GYGaiTpJ0Pr2TTXoQivb6jx-a
md5=96704c6c40e308a68d3842e83a0136b9
gdown $file_id -O $output --quiet --format pdf
actual_hash=$(md5sum $output | awk '{print $1}')
test $actual_hash = $md5
# FIXME: too unstable
# - name: Download a folder with a file count more than the limit from Google Drive
# run: |
# output=/tmp/folder-limit/
# gdown https://drive.google.com/drive/folders/1gd3xLkmjT8IckN6WtMbyFZvLR4exRIkn -O $output --quiet --folder --remaining-ok
# actual_hash=$(find $output -type f -exec md5sum {} \; | awk '{print $1}' | sort | md5sum | awk '{print $1}')
# test $actual_hash = b0e45acb8d9c7d9200ce8fe38896c790
# rm -rf $output
- name: Install from dist
run: |
rm -f dist/*.tar.gz
python setup.py sdist
pip install dist/*.tar.gz