Skip to content

create_project receiving GET response #9

@fizix137

Description

@fizix137

Running this code (edit for security):

from pycaprio import Pycaprio
client = Pycaprio("http://inception.instance.com", authentication=("user", "pass"))
client.api.create_project("test")

I got this back (edited for privacy, but all the good stuff is there.):

Traceback (most recent call last):
  File "...\Local\Programs\Python\Python38\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 8, in <module>
  File "...\venv\lib\site-packages\pycaprio\core\adapters\http_adapter.py", line 83, in create_project
    return ProjectSchema().load(response.json()['body'])
  File "...\venv\lib\site-packages\pycaprio\core\schemas\project.py", line 21, in load
    return Project(project_dict['id'], project_dict['name'])
TypeError: list indices must be integers or slices, not str

I went into the http_adapter.py file and wrote code to print out response.json() and got:

{
  'messages': [], 
  'body': [
    {'id': 2, 
      'name': 'example_-concept-linking', 
      'title': 'Example: Concept Linking'}, 
    {'id': 4, 
     'name': 'caprio', 
     'title': 'caprio'}
]
}

This looks like the body expected when submitted GET not POST. I ran this via the SwaggerUI and got back:

{
  "messages": [],
  "body": {
    "id": 6,
    "name": "test",
    "title": "test"
  }
}

What's going on here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions