Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/snirsh/bageldb-python-wrapper
A Python Wrapper for BagelDB
https://github.com/snirsh/bageldb-python-wrapper
Last synced: 5 days ago
JSON representation
A Python Wrapper for BagelDB
- Host: GitHub
- URL: https://github.com/snirsh/bageldb-python-wrapper
- Owner: snirsh
- License: mit
- Created: 2021-08-04T06:50:56.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-29T16:25:27.000Z (over 2 years ago)
- Last Synced: 2024-10-11T10:25:19.901Z (28 days ago)
- Language: Python
- Size: 52.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license
Awesome Lists containing this project
README
# bageldb-python-wrapper
A Python Wrapper for BagelDB.
Please refer first to the official docs on [BagelDB docs](https://docs.bageldb.com).## Installation and updating
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install wrapper as suggested below.
Rerun the command to check and install updates.
```bash
pip install git+https://github.com/snirsh/bageldb-python-wrapper
```## Usage
This is a wrapper for the [BagelDB docs](https://docs.bageldb.com).
Most of the features there are implemented fully here.Features:
* get_collection --> get collection
* get_single_item --> get single item in collection
* create_item --> create a new item
* update_item --> updates an existing item
* delete_item --> deletes an existing item
* write_to_nested_collection --> create item in a nested collection
* update_item_in_nested_collection --> update an existing item in a nested collection
* delete_nested_item --> delete an existing nested item
* add_image_to_item --> add image from existing URL to item
* add_local_image_to_item --> adds a local image to item#### Demo of some of the features:
```python
from BagelDBWrapper import BagelDBWrapper# Don't forget your token!
wrapper = BagelDBWrapper(api_token="<>", enable_tqdm=True) # enabling progress loggingitems = wrapper.get_collection(collection_name='articles', per_page=400, project_on="name,title", queries=[("name","!=","some")])
item_to_add = {"name": "new article"}
# remember that functions return a python-requests response
response = wrapper.create_item('articles', item_to_add)
id_of_created_item = response.json().get('id')
wrapper.delete_item(id_of_created_item)
```## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.## License
[MIT](https://choosealicense.com/licenses/mit/)