SatelCreative / spylib

A library to facilitate interfacing with Shopify's API
https://satelcreative.github.io/spylib
MIT License
3 stars 2 forks source link

✨ Add connection test to token class #218

Closed lishanl closed 8 months ago

lishanl commented 8 months ago

thought: Should this return an object instead that could contain the response time later one?

I guess it's about time not to ignore the speed of connection as well. 😅

lishanl commented 8 months ago

I want to reuse the time measurement for other connection test as well, so I made it a decorator in the utils

lishanl commented 8 months ago

any comment ant @hillairet ?

hillairet commented 8 months ago

@lishanl Here is an idea, just to get you thinking. You could make a time class with the time stored in _time to show that it's not supposed to be accessed directly. Then add the properties s() and ms() this way you don't need to carry the unit in the name of the variable.

hillairet commented 8 months ago

Or a less dumb idea: Use the timedelta class from datetime

lishanl commented 8 months ago

Or a less dumb idea: Use the timedelta class from datetime

I tried timedelta , it oddly doesn't have milliseconds attributes.

hillairet commented 8 months ago

Or a less dumb idea: Use the timedelta class from datetime

I tried timedelta , it oddly doesn't have milliseconds attributes.

Hummmmm I thought I saw it. :dizzy_face: One could extend the class to add this property but since the perf_counter is returning float time, timedelta doesn't make sense for this purpose anyway. So it was actually a dumber idea! :sweat_smile: