swagger-api / swagger-api/swagger-codegen

Issue while using Python swagger-codegen

Open
#8,956 2 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

I am not sure it is in fact an issue or more like some settings issue on my side.

I am getting below error while calling a get by code generated by swagger-codegen.

AttributeError: module 'swagger_client.models' has no attribute 'TokenResponse'

The swagger_client.models package has a module(file called token_response.py). This has the TokenResponse class, I could see that the same thing is used in petstore and it works but for me. It did not work and said that there is no attribute 'TokenResponse'.

I am using python 3.6.1.

I am sure I am missing something while executing otherwise this would have been the same issue with petstore (i did not test petstore) and people would have reported it. Do I need to do something special to achieve this.

Thanks

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

Reproduce the GET call with Python 3.6.1 and inspect swagger_client/models/token_response.py alongside the petstore client mentioned in the issue. Check how TokenResponse is exposed through swagger_client.models and document the required generation or import setup; done means the call no longer raises AttributeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.