-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add PyPI Observation API integration #1
Conversation
Put the `httpx.Client` instance in it's own module that can be imported around as necessary. Essentially a singleton. Also has authentication information and base URL attached to it, for ease for use.
It makes sense for the root route (`GET /`) to be in the `app.py` module (where the FastAPI app instance is located). This will probably be replaced by current Dragonfly Reporter API version later on in a separate PR, as the [echo endpoint](https://github.com/pypi/pypi-observation-api-private-beta?tab=readme-ov-file#get-danger-apiecho) will most likely be removed in v1.
This will make it easier to test compared to a global singleton that gets imported around - we can simply use FastAPI's [Testing Dependencies](https://fastapi.tiangolo.com/advanced/testing-dependencies/) feature.
Since this app only has two endpoints as of now (including the echo endpoint), it's probably fine to just leave it in app.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM for the most part.
Tests don't run in CI if this isn't set to *something*
Add a test case that checks that the "kind" in the payload is set to "malware," but also that "inspector_url" is not present. Normally, the Observations API requires that the "inspector_url" field be present if the kind is "is_malware," so let's see if this endpoint enforces that.
0e0ee4f
to
de9a9b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
. Note that you'll have to modify the dockerfile if you've changed how to run the server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgor 💀 |
No description provided.