Closed ddobrinskiy closed 1 month ago
fastcore/net.py
will only bypass JSON parsing after retrieving the response when archive_format
is set in route_ps
.
So to trick ghapi/core.py
into adding archive_format
to the routes, one can patch the method:
api.repos.download_tarball_archive.route_ps.append("archive_format")
then call with any value
api.repos.download_tarball_archive(..., archive_format="1")
Until there's an official fix, this works for me.
@jph00 I would like to tackle this issue and solve it for all related github endpoints.
To be able to fix this problem we need to be able to conditionally pass decode=False
to urlsend
here when we expect a non-json response (zip, tar ...etc) from an endpoint.
I understand that the metadata.py is generated using the github openapi spec, and contains all the endpoints. I have checked the github openapi spec, but could not find anything that will help to automatically identify that an endpoint will return a non-json payload.
Do you have any suggestions of solving this other than hard coding the endpoints that will return a non-json payload and setting the decode=False
argument when calling urlsend
??
Thanks for checking. No I'm not aware of any special approach. Just making a list of the route names seems fine, except that it's inconvenient to actually create that list.
Message ID: @.***>
Same error on
repos.download_tarball_archive
andrepos.download_tarball_archive
Possibly related to https://github.com/fastai/ghapi/issues/22
packages installed
steps to reproduce
full logs