coffeepenbit / bookstack

A Python wrapper for BookStack's API
MIT License
23 stars 8 forks source link

Unable to generate API methods #9

Closed deleyva closed 1 year ago

deleyva commented 1 year ago

Doing the following:

import os
import bookstack

base_url = "https://libros.catedu.es"
token_id = os.environ["BOOKSTACK_TOKEN_ID"]
token_secret = os.environ["BOOKSTACK_TOKEN_SECRET"]

api = bookstack.BookStack(base_url, token_id=token_id, token_secret=token_secret)
api.generate_api_methods()

... gives me the following traceback:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[/home/deleyva/Documentos/2022/jesus-scripts/probando.ipynb](https://file+.vscode-resource.vscode-cdn.net/home/deleyva/Documentos/2022/jesus-scripts/probando.ipynb) Cell 34 in ()
----> [1](vscode-notebook-cell:/home/deleyva/Documentos/2022/jesus-scripts/probando.ipynb#X45sZmlsZQ%3D%3D?line=0) api.generate_api_methods()

File [~/.cache/pypoetry/virtualenvs/jesus-scripts-RbQ3YFZJ-py3.8/lib/python3.8/site-packages/bookstack/models.py:33](https://file+.vscode-resource.vscode-cdn.net/home/deleyva/Documentos/2022/jesus-scripts/~/.cache/pypoetry/virtualenvs/jesus-scripts-RbQ3YFZJ-py3.8/lib/python3.8/site-packages/bookstack/models.py:33), in BookStack.generate_api_methods(self)
     31 for base_model_info in self._get_api().values():
     32     for method_info in base_model_info:
---> 33         method_name = self._create_method_name(method_info)
     35         setattr(
     36             self, 
     37             method_name,
     38             self._create_api_method(method_info)
     39         )
     41         self.available_api_methods.add(method_name)

File [~/.cache/pypoetry/virtualenvs/jesus-scripts-RbQ3YFZJ-py3.8/lib/python3.8/site-packages/bookstack/models.py:64](https://file+.vscode-resource.vscode-cdn.net/home/deleyva/Documentos/2022/jesus-scripts/~/.cache/pypoetry/virtualenvs/jesus-scripts-RbQ3YFZJ-py3.8/lib/python3.8/site-packages/bookstack/models.py:64), in BookStack._create_method_name(self, method_info)
     62 def _create_method_name(self, method_info):
     63     return self._format_camelcase(
---> 64         '_'.join([method_info['method'], method_info['name']])
     65     )

TypeError: string indices must be integers
deleyva commented 1 year ago

sorry... bad credentials