| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Related issue: #1419
My guess is because there is only one item in the list it doesn't like it.
Likely we need to add support for doing approver_ids[]=423 (which is adding []).
Likely we need to add support for doing approver_ids[]=423 (which is adding []).
Unfortunatly, I havn't found an example on in the Gitlab docs on how to encode the array, but guessing from this post, the URL argument may be approver_ids[]=423 just like you wrote.
My guess is because there is only one item in the list it doesn't like it.
Hmm, having the same issue with two user ids:
group_mrs = group.mergerequests.list(
all=True,
state="opened",
author_id=423,
approver_ids=[11, 423],
)[22:37:00] DEBUG Starting new HTTPS connection (1): *redacted*:443 connectionpool.py:971
DEBUG https://*redacted*:443 "GET /api/v4/user HTTP/1.1" 200 None connectionpool.py:452
[22:37:01] DEBUG https://*redacted*:443 "GET /api/v4/groups/475 HTTP/1.1" 200 None connectionpool.py:452
DEBUG https://*redacted*:443 "GET connectionpool.py:452
/api/v4/groups/475/merge_requests?state=opened&author_id=423&approver_ids=11%2C423
HTTP/1.1" 400 60
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/gitlab/exceptions.py", line 304, in wrapped_f
return f(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/gitlab/mixins.py", line 242, in list
obj = self.gitlab.http_list(path, **data)
File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 718, in http_list
return list(GitlabList(self, url, query_data, **kwargs))
File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 881, in __init__
self._query(url, query_data, **self._kwargs)
File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 891, in _query
result = self._gl.http_request("get", url, query_data=query_data, **kwargs)
File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 628, in http_request
raise gitlab.exceptions.GitlabHttpError(
gitlab.exceptions.GitlabHttpError: 400: approver_ids should be an array, 'None' or 'Any'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "*redacted*.py", line 30, in <module>
group_mrs = group.mergerequests.list(
File "/usr/local/lib/python3.9/site-packages/gitlab/exceptions.py", line 306, in wrapped_f
raise error(e.error_message, e.response_code, e.response_body) from e
gitlab.exceptions.GitlabListError: 400: approver_ids should be an array, 'None' or 'Any'
Unfortunatly, I havn't found an example on in the Gitlab docs on how to encode the array, but guessing from this post, the URL argument may be approver_ids[]=423 just like you wrote.
https://docs.gitlab.com/ee/api/#array
So if approver_ids=[11, 423]
It is supposed to be something like: approver_ids[]=11&approver_ids[]=423 in the actual HTTP request. Though currently it will also work as approver_ids=11,423 as it understands a comma separated string is a list.
I dug into this a bit more:
So to fix this we need to send the arrays in the proper way.
Ah, looks like the comma gets URL-encoded there so that might be related to #1356 and similar. Or, maybe it's meant to be encoded I should probably check first :D
I believe the URL encoding there is correct. I dug into it a bit and it is done by requests.
I have a draft PR that might fix this: #1699
I think it should work for 1 ID in the list but unsure if 2 or more IDs were in the approver_ids list. Not sure how the GitLab server will react to that...
@skycaptain #1699 is available which should resolve the issue. In my testing it is working to fix this issue.
@JohnVillalovos works!
@JohnVillalovos works!
Awesome. Thank you for testing it @skycaptain !
| Back | FazBrowse Home | New Git URL |
Description of the problem, including code/CLI snippet
There might be a possible regression of #1010 with the latest version. The issue is exactly the same:
[21:49:48] DEBUG Starting new HTTPS connection (1): *redacted*:443 connectionpool.py:971 DEBUG https://*redacted*:443 "GET /api/v4/user HTTP/1.1" 200 None connectionpool.py:452 [21:49:49] DEBUG https://*redacted*:443 "GET /api/v4/groups/475 HTTP/1.1" 200 None connectionpool.py:452 DEBUG https://*redacted*:443 "GET connectionpool.py:452 /api/v4/groups/475/merge_requests?state=opened&author_id=423&approver_ids=423 HTTP/1.1" 400 60 Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/gitlab/exceptions.py", line 304, in wrapped_f return f(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/gitlab/mixins.py", line 242, in list obj = self.gitlab.http_list(path, **data) File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 718, in http_list return list(GitlabList(self, url, query_data, **kwargs)) File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 881, in __init__ self._query(url, query_data, **self._kwargs) File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 891, in _query result = self._gl.http_request("get", url, query_data=query_data, **kwargs) File "/usr/local/lib/python3.9/site-packages/gitlab/client.py", line 628, in http_request raise gitlab.exceptions.GitlabHttpError( gitlab.exceptions.GitlabHttpError: 400: approver_ids should be an array, 'None' or 'Any' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "*redacted*.py", line 30, in <module> group_mrs = group.mergerequests.list( File "/usr/local/lib/python3.9/site-packages/gitlab/exceptions.py", line 306, in wrapped_f raise error(e.error_message, e.response_code, e.response_body) from e gitlab.exceptions.GitlabListError: 400: approver_ids should be an array, 'None' or 'Any'Expected Behavior
Return merge requests for the specified approver_ids.
Actual Behavior
Raises an exception.
Specifications