-
Notifications
You must be signed in to change notification settings - Fork 20
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
Improve API client UX #35
Comments
another use case: i would like to use the API client modules but am not interested in the db loading. from that perspective it may be logical to split the api/db purposes into separate packages. i'll be spending more time with this project in the coming weeks. hope i can contribute. |
+1 |
I'm not sure I see the benefit here. The only dependency related to Of course you don't have to |
True. I'm mostly thinking of the |
as an aside, looks like |
It's only used here: Line 70 in dc5b7e0
To convert a |
Perhaps an improvement to names, re: CityofSantaMonica#46 CityofSantaMonica#35
Perhaps an improvement to names, re: CityofSantaMonica#46 CityofSantaMonica#35
Thanks to #40 and #71 the above changes will be made, including the move to a single provider per Initialize with a provider name or identifier directly:client_A = ProviderClient("ProviderA")
client_B = ProviderClient("da80482e-1118-48e8-bccc-38492960bd17")
# optionally pass in configuration data
client_C = ProviderClient("ProviderC", config={ "token": "private" }) Use a provider name or identifier at request time:client = ProviderClient()
trips_A = client.get_trips("ProviderA")
trips_B = client.get_trips("da80482e-1118-48e8-bccc-38492960bd17")
# optionally pass in configuration data
trips_C = client.get_trips("ProviderC", config={ "token": "private" }) |
Right now the usage is a multi-step process including at least:
auth_token
etc., assuming you know how to generate all the different types of tokensProviderClient
toget_status_changes()
orget_trips()
It is also somewhat confusing to have a
ProviderClient
that "manages" or queries multiple Providers at once. The code is probably over-complicated because of this as well...This could all be simplified with some specific improvements to this class:
allow the
providers
keyword arg in both__init__
and theget_*
methods to accept a string or array of string provider names. Internally handle filtering the registry (ProviderClient
already can query and obtain the registry itself).allow for a
config
parameter in__init__
and theget_*
methods to pass in provider configuration, vs. having to configure them ahead of time.consider removing support for "managing" multiple providers at once - one Provider, one ProviderClient.
The text was updated successfully, but these errors were encountered: