🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@berinhard
Copy link
Contributor

This PR introduces a new endpoint in the sponsors API to filter assets by their internal_name. The endpoint URL is /api/v2/sponsors/sponsorship-assets/ and it always require a internal_name to be passed as a query string parameter. If internal_name is missing, the response is a bad request.

By default, the endpoint only lists assets which have a value (text or image) associated to it, but it's possible to list every asset by passing list_empty=true within the query string.

Here's a response payload example I got from my local database:

[{
  "internal_name": "pycon_logo",
  "uuid": "55f69c46-8d94-4196-9157-76ed6219b120",
  "value": "/media/sponsors-app-assets/55f69c46-8d94-4196-9157-76ed6219b120.jpeg",
  "content_type": "Sponsor",
  "sponsor": "Globe"
}, {
  "internal_name": "pycon_logo",
  "uuid": "2f05d02c-e78a-4976-8b77-5a665612c776",
  "value": "/media/sponsors-app-assets/2f05d02c-e78a-4976-8b77-5a665612c776.jpeg",
  "content_type": "Sponsor",
  "sponsor": "BerinTech"
}]

@berinhard berinhard requested a review from ewdurbin February 25, 2022 19:16
@berinhard
Copy link
Contributor Author

berinhard commented Feb 25, 2022

@ewdurbin I'm not sure why this PR is breaking on CI. The tests aren't eve running due to an import error. The error is: ImportError: cannot import name 'getStringIO' from 'reportlab.lib.utils' (/opt/hostedtoolcache/Python/3.9.6/x64/lib/python3.9/site-packages/reportlab/lib/utils.py) but even when I run the same command locally, they run just fine. I've already reset my virtualenv to reinstall the dependencies, but they still pass.

Here's a proof that I'm being able to import this function:

$ pip freeze | grep reportlab
reportlab==3.6.1
$ python -c "from reportlab.lib.utils import getStringIO; print(getStringIO)"
<function getStringIO at 0x7ff979753488>

Any ideas on what can be causing the import error?

@berinhard
Copy link
Contributor Author

berinhard commented Feb 25, 2022

@ewdurbin the CI should be fixed now. The issue was happening due to the new reportlab 3.6.7 release this last February 18. For some reason, the import only started to break after it. Under versions 3.6.6, I was able to run the tests as expected.

The 3.6.7 version was being installed because the one of the easy_pdf dependencies depends on it and was declaring it with reportlab>=3.3.0. Thus, I added ab7da79 to force a limit to the version we want to use.

@ewdurbin ewdurbin merged commit 57dc909 into main Feb 25, 2022
@ewdurbin ewdurbin deleted the feature/assets-api-endpoint branch February 25, 2022 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants