swagger-api / swagger-api/swagger-codegen

Python swagger-codegen hard-coded base URL

Open
#7,804 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Python General: Question
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Swagger API client for python should allow for the base URL to be passed via arguments at runtime

Swagger-codegen version

2.3.1

Swagger declaration file content or url

Any, can use petstore.

Command line used for generation

swagger-codegen generate -i swagger.yaml -l python -o client-lib

Steps to reproduce

Cannot pass URL to client library

Related issues/PRs
Suggest a fix/enhancement

Instead of hard-coding the base URL like here, instead pass it as a parameter to init in Configuration (or anywhere else that makes sense).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with samples/client/petstore/python/petstore_api/configuration.py and the generation command shown in the issue. Trace how the Python client's Configuration is created and how the base URL is set. Done means the generated client can receive a runtime base URL instead of relying on the hard-coded value.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.