summaryrefslogtreecommitdiff
path: root/gitlab/client.py
Commit message (Collapse)AuthorAgeFilesLines
* chore: enforce type-hints on most files in gitlab/v4/objects/jlvillal/mypy_small_files_1John L. Villalovos2021-11-081-6/+8
| | | | | | | * Add type-hints to some of the files in gitlab/v4/objects/ * Fix issues detected when adding type-hints * Changed mypy exclusion to explicitly list the 13 files that have not yet had type-hints added.
* refactor: use f-strings for string formattingNejc Habjan2021-11-051-5/+5
|
* chore: fix type-check issue shown by new requests-typesJohn L. Villalovos2021-10-061-0/+2
| | | | | types-requests==2.25.9 changed a type-hint. Update code to handle this change.
* feat: default to gitlab.com if no URL givenNejc Habjan2021-09-081-3/+14
| | | | | BREAKING CHANGE: python-gitlab will now default to gitlab.com if no URL is given
* fix!: raise error if there is a 301/302 redirectionJohn L. Villalovos2021-09-081-19/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Before we raised an error if there was a 301, 302 redirect but only from an http URL to an https URL. But we didn't raise an error for any other redirects. This caused two problems: 1. PUT requests that are redirected get changed to GET requests which don't perform the desired action but raise no error. This is because the GET response succeeds but since it wasn't a PUT it doesn't update. See issue: https://github.com/python-gitlab/python-gitlab/issues/1432 2. POST requests that are redirected also got changed to GET requests. They also caused hard to debug tracebacks for the user. See issue: https://github.com/python-gitlab/python-gitlab/issues/1477 Correct this by always raising a RedirectError exception and improve the exception message to let them know what was redirected. Closes: #1485 Closes: #1432 Closes: #1477
* feat: allow global retry_transient_errors setupKarun Japhet2021-08-291-4/+8
| | | | | | `retry_transient_errors` can now be set through the Gitlab instance and global configuration Documentation for API usage has been updated and missing tests have been added.
* docs: make Gitlab class usable for intersphinxNejc Habjan2021-06-141-0/+33
|
* feat: add keys endpointBen Brown2021-06-031-0/+1
|
* docs: fix typo in http_delete docstringBen Brown2021-06-011-1/+1
|
* chore: apply typing suggestionsNejc Habjan2021-05-311-7/+11
| | | | Co-authored-by: John Villalovos <john@sodarock.com>
* feat(objects): add support for generic packages APINejc Habjan2021-05-311-29/+41
|
* chore: apply suggestionsNejc Habjan2021-05-301-1/+1
|
* feat(objects): support all issues statistics endpointsNejc Habjan2021-05-301-0/+1
|
* chore: fix import ordering using isortJohn L. Villalovos2021-05-251-4/+2
| | | | | | Fix the import ordering using isort. https://pycqa.github.io/isort/
* Merge pull request #1392 from bbatliner/patch-1Max Wittig2021-04-231-10/+18
|\ | | | | Improvements to HTTP requests
| * fix: only append kwargs as query parametersBrendan Batliner2021-04-071-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Some arguments to `http_request` were being read from kwargs, but kwargs is where this function creates query parameters from, by default. In the absence of a `query_parameters` param, the function would construct URLs with query parameters such as `retry_transient_errors=True` despite those parameters having no meaning to the API to which the request was sent. This change names those arguments that are specific to `http_request` so that they do not end up as query parameters read from kwargs.
| * fix: only add query_parameters to GitlabList onceBrendan Batliner2021-04-071-0/+3
| | | | | | | | Fixes #1386
* | fix: update user's bool data and avatarDylann Cordel2021-04-221-0/+6
|/ | | | | | | If we want to update email, avatar and do not send email confirmation change (`skip_reconfirmation` = True), `MultipartEncoder` will try to encode everything except None and bytes. So it tries to encode bools. Casting bool's values to their stringified int representation fix it.
* chore: put assert statements inside 'if TYPE_CHECKING:'John L. Villalovos2021-03-021-8/+15
| | | | | | | | | | | To be safe that we don't assert while running, put the assert statements, which are used by mypy to check that types are correct, inside an 'if TYPE_CHECKING:' block. Also, instead of asserting that the item is a dict, instead assert that it is not a requests.Response object. Theoretically the JSON could return as a list or dict, though at this time we are assuming a dict.
* chore: disallow incomplete type defsJohn L. Villalovos2021-02-281-17/+19
| | | | | | | | | | Don't allow a partially annotated function definition. Either none of the function is annotated or all of it must be. Update code to ensure no-more partially annotated functions. Update gitlab/cli.py with better type-hints. Changed Tuple[Any, ...] to Tuple[str, ...]
* chore: add and fix some type-hints in gitlab/client.pyJohn L. Villalovos2021-02-271-4/+6
| | | | Was able to figure out better type-hints for gitlab/client.py
* chore: add type-hints to gitlab/client.pyJohn L. Villalovos2021-02-261-77/+139
| | | | Adding some initial type-hints to gitlab/client.py
* chore: remove unused function _construct_url()John L. Villalovos2021-02-231-18/+0
| | | | | | The function _construct_url() was used by the v3 API. All usage of the function was removed in commit fe89b949922c028830dd49095432ba627d330186
* feat: add an initial mypy test to tox.iniJohn L. Villalovos2021-02-221-1/+1
| | | | Add an initial mypy test to test gitlab/base.py and gitlab/__init__.py
* chore: remove usage of 'from ... import *' in client.pyJohn L. Villalovos2021-02-221-16/+16
| | | | | | | | | | | | | | | | In gitlab/client.py remove usage of: * from gitlab.const import * * from gitlab.exceptions import * Change them to: * import gitlab.const * import gitlab.exceptions Update code to explicitly reference things in gitlab.const and gitlab.exceptions A flake8 run no longer lists any undefined variables. Before it listed possible undefined variables.
* chore: explicitly import gitlab.v4.objects/cliJohn L. Villalovos2021-02-211-4/+16
| | | | | | | | | | | | | | | | | As we only support the v4 Gitlab API, explicitly import gitlab.v4.objects and gitlab.v4.clie instead of dynamically importing it depending on the API version. This has the added benefit of mypy being able to type check the Gitlab __init__() function as currently it will fail if we enable type checking of __init__() it will fail. Also, this also helps by not confusing tools like pyinstaller/cx_freeze with dynamic imports so you don't need hooks for standalone executables. And according to https://docs.gitlab.com/ee/api/, "GraphQL co-exists with the current v4 REST API. If we have a v5 API, this should be a compatibility layer on top of GraphQL."
* refactor: move Gitlab and GitlabList to gitlab/client.pyJohn L. Villalovos2021-02-181-0/+858
Move the classes Gitlab and GitlabList from gitlab/__init__.py to the newly created gitlab/client.py file. Update one test case that was depending on requests being defined in gitlab/__init__.py