Skip to content

[Python] Make API client more pluggable #787

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

Merged

Conversation

geekerzp
Copy link
Contributor

  • Allows developers to easily customize APIClient and use it to initialize the API class (e.g. PetApi)

  • Allows developers to skip the initialization of a new APIClient as the API class (e.g. PetApi) will automatically construct a new default API client if no client has been initialized). For example, the following line becomes optional:

    api_client = SwaggerPetstore.APIClient('http://petstore.swagger.io/v2')
  • Tested without issue

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 26.713 s
    [INFO] Finished at: 2015-05-25T14:45:45+08:00
    [INFO] Final Memory: 11M/156M
    [INFO] ------------------------------------------------------------------------

geekerzp added 2 commits May 25, 2015 14:31
When create api instance, if we don't pass the `api_client` parameter,
then use the default api_client in `config` module.
Change staticmethod to instance method.
fehguy added a commit that referenced this pull request Jun 5, 2015
[Python] Make API client more pluggable
@fehguy fehguy merged commit 13e1465 into swagger-api:develop_2.0 Jun 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants