Closed
Description
Description of the problem, including code/CLI snippet
I was using the following solution to iterate over the jobs:
@Duncz there is the solution I used in my project:
scopes = ['pending', 'running', 'failed', 'success'] jobs = git_project.jobs.list(query_parameters={'scope[]': scopes})Should work.
Originally posted by @romansvozil in #806 (comment)
When using it with as_list=False
the scope is added to each next_url
again. This results at some point to a 502 Bad Gateway error, because the URL is getting too long.
Here is a small example how I was able to reproduce it:
try:
for idx, job in enumerate(project.jobs.list(query_parameters={'scope[]': ['failed', 'success']}, as_list=False), start=1):
if idx == 500:
break
except Exception as exc:
print(exc)
The URL is getting too long at idx == 400.
I think it started to appear after #1124 was merged. Anyhow it seems related to the brackets in the scope parameter, maybe because they get encoded in the URL.
Expected Behavior
Iterating through all jobs.
Actual Behavior
Getting a 502 Bad Gateway after some iterations because the URL is getting too long.
Specifications
- python-gitlab version: 2.6.0
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): 13.7.4
Metadata
Metadata
Assignees
Labels
No labels