Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Performance suggestion #57

Open
gwillem opened this issue Jan 23, 2023 · 2 comments
Open

Performance suggestion #57

gwillem opened this issue Jan 23, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@gwillem
Copy link

gwillem commented Jan 23, 2023

Thanks for making this library!

FWIW, I think it's good Python practice to not execute remote calls upon instantiating a new object. In this case, creating an API object will run 7 identical calls to /api/v2/stats via client.check_headers().

@skoudoro
Copy link
Owner

Hi @gwillem,

Thank you for your suggestion, that's a good point!

I need to find a work around, because I still want to keep the possibility to just use Campaign object without using api object.

Feel free to contribute if you have a good strategy. Busy week coming, so I will look into it this coming weekend

@skoudoro skoudoro added the enhancement New feature or request label Jan 23, 2023
@gwillem
Copy link
Author

gwillem commented Jan 23, 2023

I still want to keep the possibility to just use Campaign object without using api object.

What is your use case? Perhaps its better to split into models and verbs? It's a common design, see for example https://github.com/chargebee/chargebee-python

Also, why are you pre-validating headers and why not just proxy the error from ML if the headers are faulty? What kind of OSError are you expecting?

The requests module already supports put and delete functions, why duplicate them in client.py?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants