VirusTotal / vt-py

The official Python 3 client library for VirusTotal
https://virustotal.github.io/vt-py/
Apache License 2.0
531 stars 121 forks source link

add quota_summary to Client #178

Closed malwarefrank closed 6 months ago

malwarefrank commented 7 months ago

Add a method to easily get the quota summary for a given user, or the current Client's apikey by default.

google-cla[bot] commented 7 months ago

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

plusvic commented 7 months ago

Should we go down the road of creating new Client method for specific API calls? If so, where's the limit? We could end up creating one method per REST API, which would make this client hard to maintain.

malwarefrank commented 7 months ago

Should we go down the road of creating new Client method for specific API calls? If so, where's the limit? We could end up creating one method per REST API, which would make this client hard to maintain.

Good question. The VirustTotal API certainly contains many objects and resources. Trying to support them all would be a lot of work.

What I would say about this PR is that checking one's quota usage feels more like a common, core functionality than an uncommon, unique need. Let me know what you think. In the meantime, I will work on a set of tests.

plusvic commented 7 months ago

Good question. The VirustTotal API certainly contains many objects and resources. Trying to support them all would be a lot of work.

Exactly, that's what I was thinking about when I wrote my comment. The intention with vt-py is to provide a thin layer that simplifies the interaction with the REST API, without trying to completely hide the REST API. Think of it as the Python's requests library, but specifically tailored to work with the VirusTotal API. The methods in vt-py are general enough to work with multiple endpoints, with some exceptions like scan_file which was worth the inclusion because it's VirusTotal's bread and butter, and it's not as straightforward as it may look like.

But for simple actions like calling the "/users/{id}/overall_quotas endpoint, I think that adding a dedicated method goes against this principle of keeping vt-py as a thin client.