coffeepenbit / bookstack Goto Github PK
View Code? Open in Web Editor NEWA Python wrapper for BookStack's API
License: MIT License
A Python wrapper for BookStack's API
License: MIT License
I cannot call any post methods.
Installed with PIP
Version: 0.1.0b0
Error: TypeError: BookStack._create_api_method..request_method() takes 0 positional arguments but 1 was given
I don't know if I am doing something wrong, but it happens, even if i call the method from the readme?!
hi, first of all i am a total python newbee and i am trying to use your bookstack api.
the connection works and the api element shows me all the allowed api methods.
however i am not able to perform a post request.
is it somehow possible to add a minimal sample how to perform a post request using a simple json payload ?
That would be awesome. Thanks
Seems like POST methods don't send the POST data, such as name when creating a book. I tried to use name and data kwargs but always got 422 error.
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
Our wiki has 100+ pages. The list methods of this framework only return up to 100 records at a time. We have tried including offset, count, and filter as keyword arguments in several different ways but no luck. Is it possible to include these parameters when calling the list methods? If yes, could you let us know how?
The code is as follows so far
api = bookstack.BookStack(base_url,
token_id=token_id,
token_secret=token_secret)
api.generate_api_methods()
the output
Traceback (most recent call last):
File "/home/keith/repo/release-automation-bookstack/release-checklist.py", line 13, in <module>
api.generate_api_methods()
File "/home/keith/repo/release-automation-bookstack/.venv/lib/python3.11/site-packages/bookstack/models.py", line 33, in generate_api_methods
method_name = self._create_method_name(method_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/keith/repo/release-automation-bookstack/.venv/lib/python3.11/site-packages/bookstack/models.py", line 70, in _create_method_name
'_'.join([method_info['method'], method_info['name']])
~~~~~~~~~~~^^^^^^^^^^
TypeError: string indices must be integers, not 'str'
BookStack v23.05.1
Python 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] on linux
I think, this is wrong:
bookstack/src/bookstack/models.py
Line 50 in ac63b0e
POST didn't work because **kwargs was not passed to the requests function. Therefore, it was not possible to use the data
parameter.
response = self._session.request(
method_info['method'],
#method_info['uri'].format(**kwargs) <- this didn't work for POST
method_info['uri'],
**kwargs
)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.