Search code examples
pythonswaggerswagger-codegen

python swagger client set host and port


How should you specify host and port in the python client library auto-generated by swagger-codegen?

The only documentation that I found is here.


Solution

  • The target host gets hard-coded in the client code, e.g.:

    https://github.com/swagger-api/swagger-codegen/blob/master/samples/client/petstore/python/petstore_api/configuration.py#L50

    # configuration.py
    
    ...
    
    def __init__(self):
      """Constructor"""
      # Default Base url
      self.host = "http://petstore.swagger.io:80/v2"