Title: fix(cli): make 'timeout', 'per_page' and 'page' type explicit by thomasgl-orange · Pull Request #1862 · python-gitlab/python-gitlab · GitHub
Open Graph Title: fix(cli): make 'timeout', 'per_page' and 'page' type explicit by thomasgl-orange · Pull Request #1862 · python-gitlab/python-gitlab
X Title: fix(cli): make 'timeout', 'per_page' and 'page' type explicit by thomasgl-orange · Pull Request #1862 · python-gitlab/python-gitlab
Description: This PR is mainly for fixing handling of --timeout / GITLAB_TIMEOUT. Before: $ docker run -it --rm python-gitlab:latest --timeout=10 project get --id gitlab-org/gitlab Impossible to get object (Timeout value connect was 10, but it must be an int, float or None.) $ docker run -it --rm -e GITLAB_TIMEOUT=10 python-gitlab:latest project get --id gitlab-org/gitlab Impossible to get object (Timeout value connect was 10, but it must be an int, float or None.) After (with bbb7df5): $ docker run -it --rm python-gitlab:latest --timeout 10 project get --id gitlab-org/gitlab id: 278964 path: gitlab $ docker run -it --rm -e GITLAB_TIMEOUT=10 python-gitlab:latest project get --id gitlab-org/gitlab id: 278964 path: gitlab $ docker run -it --rm python-gitlab:latest --timeout xxx project get --id gitlab-org/gitlab usage: gitlab [--version] [-v] [-d] [-c CONFIG_FILE] [-g GITLAB] [-o {json,legacy,yaml}] [-f FIELDS] [--server-url SERVER_URL] [--ssl-verify SSL_VERIFY] [--timeout TIMEOUT] [--api-version API_VERSION] [--per-page PER_PAGE] [--pagination PAGINATION] [--order-by ORDER_BY] [--user-agent USER_AGENT] [--private-token PRIVATE_TOKEN | --oauth-token OAUTH_TOKEN | --job-token JOB_TOKEN] gitlab: error: argument --timeout: invalid int value: 'xxx' $ docker run -it --rm -e GITLAB_TIMEOUT=xxx python-gitlab:latest project get --id gitlab-org/gitlab usage: gitlab [--version] [-v] [-d] [-c CONFIG_FILE] [-g GITLAB] [-o {json,legacy,yaml}] [-f FIELDS] [--server-url SERVER_URL] [--ssl-verify SSL_VERIFY] [--timeout TIMEOUT] [--api-version API_VERSION] [--per-page PER_PAGE] [--pagination PAGINATION] [--order-by ORDER_BY] [--user-agent USER_AGENT] [--private-token PRIVATE_TOKEN | --oauth-token OAUTH_TOKEN | --job-token JOB_TOKEN] gitlab: error: argument --timeout: invalid int value: 'xxx' The 2nd commit (d493a5e) is less a fix, it's more to make things coherent for these two other int arguments. It improves handling of non-int values, I think. Before: $ docker run -it --rm -e GITLAB_PER_PAGE=xxx python-gitlab:latest project list Impossible to list objects (400: per_page is invalid) $ docker run -it --rm python-gitlab:latest --per-page xxx project list Impossible to list objects (400: per_page is invalid) $ docker run -it --rm python-gitlab:latest --per-page 2 project list --page xxx Impossible to list objects (400: page is invalid) After (with d493a5e): $ docker run -it --rm -e GITLAB_PER_PAGE=xxx python-gitlab:latest project list usage: gitlab [--version] [-v] [-d] [-c CONFIG_FILE] [-g GITLAB] [-o {json,legacy,yaml}] [-f FIELDS] [--server-url SERVER_URL] [--ssl-verify SSL_VERIFY] [--timeout TIMEOUT] [--api-version API_VERSION] [--per-page PER_PAGE] [--pagination PAGINATION] [--order-by ORDER_BY] [--user-agent USER_AGENT] [--private-token PRIVATE_TOKEN | --oauth-token OAUTH_TOKEN | --job-token JOB_TOKEN] gitlab: error: argument --per-page: invalid int value: 'xxx' $ docker run -it --rm python-gitlab:latest --per-page xxx project list usage: gitlab [--version] [-v] [-d] [-c CONFIG_FILE] [-g GITLAB] [-o {json,legacy,yaml}] [-f FIELDS] [--server-url SERVER_URL] [--ssl-verify SSL_VERIFY] [--timeout TIMEOUT] [--api-version API_VERSION] [--per-page PER_PAGE] [--pagination PAGINATION] [--order-by ORDER_BY] [--user-agent USER_AGENT] [--private-token PRIVATE_TOKEN | --oauth-token OAUTH_TOKEN | --job-token JOB_TOKEN] gitlab: error: argument --per-page: invalid int value: 'xxx' $ docker run -it --rm python-gitlab:latest --per-page 2 project list --page xxx usage: gitlab project list [-h] [--sudo SUDO] [--archived ARCHIVED] [--id-after ID_AFTER] [--id-before ID_BEFORE] [--last-activity-after LAST_ACTIVITY_AFTER] [--last-activity-before LAST_ACTIVITY_BEFORE] [--membership MEMBERSHIP] [--min-access-level MIN_ACCESS_LEVEL] [--order-by ORDER_BY] [--owned OWNED] [--repository-checksum-failed REPOSITORY_CHECKSUM_FAILED] [--repository-storage REPOSITORY_STORAGE] [--search-namespaces SEARCH_NAMESPACES] [--search SEARCH] [--simple SIMPLE] [--sort SORT] [--starred STARRED] [--statistics STATISTICS] [--topic TOPIC] [--visibility VISIBILITY] [--wiki-checksum-failed WIKI_CHECKSUM_FAILED] [--with-custom-attributes WITH_CUSTOM_ATTRIBUTES] [--with-issues-enabled WITH_ISSUES_ENABLED] [--with-merge-requests-enabled WITH_MERGE_REQUESTS_ENABLED] [--with-programming-language WITH_PROGRAMMING_LANGUAGE] [--page PAGE] [--per-page PER_PAGE] [--all] gitlab project list: error: argument --page: invalid int value: 'xxx' Note: all tests/examples above are run after rebuilding a container as documented in the README, so it seems to be with Python 3.10 (on Alpine).
Open Graph Description: This PR is mainly for fixing handling of --timeout / GITLAB_TIMEOUT. Before: $ docker run -it --rm python-gitlab:latest --timeout=10 project get --id gitlab-org/gitlab Impossible to get object (Tim...
X Description: This PR is mainly for fixing handling of --timeout / GITLAB_TIMEOUT. Before: $ docker run -it --rm python-gitlab:latest --timeout=10 project get --id gitlab-org/gitlab Impossible to get object (Tim...
Opengraph URL: https://github.com/python-gitlab/python-gitlab/pull/1862
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:748e481f-9fb3-978c-291f-9455369a2975 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | AB54:2A0D6:2D5012D:3DD044A:697376F3 |
| html-safe-nonce | 18e751a0a624dd3246a3d7fdb4e053dd14a792af1b3622ed09a00ae824fa62fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQjU0OjJBMEQ2OjJENTAxMkQ6M0REMDQ0QTo2OTczNzZGMyIsInZpc2l0b3JfaWQiOiI2MDc2MzU0NzQ5NTcxMjMzNTIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 524461cfe998a2f454254edfbf5123ed1d4a97c054e1743c1c69af427929287e |
| hovercard-subject-tag | pull_request:831927717 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python-gitlab/python-gitlab/pull/1862/files |
| twitter:image | https://avatars.githubusercontent.com/u/6212720?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/6212720?s=400&v=4 |
| og:image:alt | This PR is mainly for fixing handling of --timeout / GITLAB_TIMEOUT. Before: $ docker run -it --rm python-gitlab:latest --timeout=10 project get --id gitlab-org/gitlab Impossible to get object (Tim... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4cf879a11b0a28a85543899a36aaee9ec9ca2fb7bedad86c0da5731193c95f01 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python-gitlab/python-gitlab git https://github.com/python-gitlab/python-gitlab.git |
| octolytics-dimension-user_id | 28886265 |
| octolytics-dimension-user_login | python-gitlab |
| octolytics-dimension-repository_id | 8077625 |
| octolytics-dimension-repository_nwo | python-gitlab/python-gitlab |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 8077625 |
| octolytics-dimension-repository_network_root_nwo | python-gitlab/python-gitlab |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | fe8be790582ef7a55477ce1918ac0ed16b106d31 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width