question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

request_strategy parameter for APIClient constructor

See original GitHub issue

Hi Mike,

I’m enjoying using this library, so thanks for your time and efforts putting it together!

Is your feature request related to a problem? Please describe. I’d like to pass a RequestStrategy to the client constructor.

Describe the solution you’d like Similar to how the client accepts authentication_method et al. as constructor params, I’d like to be able to pass a request_strategy instance one way or another.

Describe alternatives you’ve considered I construct the client and then call set_request_strategy() on the client instance.

Additional context Is it that the request strategy needs to be a distinct instance per client given the client is persisted on the strategy? Would you consider a parameter that accepts a callable which returns a strategy instance? It might be RequestStrategy type or something more complicated. Or perhaps a None default value for parameter that accepts an instance so that if nothing is passed in a fresh RequestStragegy can be constructed for the client?

As mentioned above, in terms of LOC this is only saving 1 call to set_request_strategy() so I’d entirely understand if you decide its not worth the effort!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
mom1commented, Feb 26, 2021

I would like to suggest setting this parameter in the attribute of the child class. so as not to override the __init__ method.

class MyClient(ApiClient):
    request_strategy = MyRequestStrategy()
0reactions
MikeWoostercommented, Mar 19, 2021

resolved by #58

Read more comments on GitHub >

github_iconTop Results From Across the Web

ApiClient (client-java-api 12.0.0 API) - javadoc.io
Helper method to set API key prefix for the first API key authentication. Parameters: apiKeyPrefix - API key prefix. setAccessToken. public void setAccessToken ......
Read more >
OpenAPI generator add/generate annotation to ApiClient ...
In my application I have now two different RestTemplate beans. So Spring does not know which one to use in the ApiClient constructor....
Read more >
Api Client - Oat++
HTTP calls with oatpp Api Client. ... Path Variables Mapping; Headers Mapping; Query Parameters Mapping; Body Parameter Mapping. Create Api Client.
Read more >
Class: DatadogAPIClient::V2::APIClient
Build parameter value according to the given collection format. ... #initialize(config = Configuration.default) ⇒ APIClient constructor.
Read more >
[REQ] [csharp],[csharp-netcore] Add Parameter Less Default ...
I've been using openapi-generator-cli for generating APIClient Nugets to ... Add Parameter Less Default Constructors For Model Classes #8162.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found