webcompat.com icon indicating copy to clipboard operation
webcompat.com copied to clipboard

Give similar shapes to api_request and proxy_request

Open karlcow opened this issue 4 years ago • 1 comments

proxy_request and api_request do not return the same type of object This creates unnecessary difficulties, such as seen in #3606 and #3607

https://github.com/webcompat/webcompat.com/blob/e5dbd1c8ea33e329dd5e295268c2f0717aa9f7dc/webcompat/helpers.py#L459-L481

https://github.com/webcompat/webcompat.com/blob/e5dbd1c8ea33e329dd5e295268c2f0717aa9f7dc/webcompat/helpers.py#L436-L456

so when we reach, the object is not working

https://github.com/webcompat/webcompat.com/blob/e5dbd1c8ea33e329dd5e295268c2f0717aa9f7dc/webcompat/api/endpoints.py#L68-L70

The request has been correctly sent but the answers is not in the format we expect.

This is the shape of the content we receive once going through api_request, a tuple with 3 values.

Capture d’écran 2021-07-22 à 09 17 14

While the edit.content, edit.status_code is trying to access properties of an object, this can be fixed with a quick hack testing the nature, the type of edit

Originally posted by @karlcow in https://github.com/webcompat/webcompat.com/issues/3606#issuecomment-884579305

karlcow avatar Jul 22 '21 00:07 karlcow

proxy_request returns a Response object.

Capture d’écran 2021-07-22 à 10 44 53

karlcow avatar Jul 22 '21 01:07 karlcow