Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hvuhsg/qwhaledbclient
https://github.com/hvuhsg/qwhaledbclient
Last synced: 7 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/hvuhsg/qwhaledbclient
- Owner: hvuhsg
- License: mit
- Created: 2020-11-27T12:15:43.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-01-25T18:09:10.000Z (almost 3 years ago)
- Last Synced: 2024-08-10T11:18:14.257Z (3 months ago)
- Language: Python
- Size: 49.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# qwhale-client
## This is the official python client library
The library is simple, all you need is a TOKEN that you can get from our website hare
and that it! you are ready to work with our service.The library works with [_pymongo_](https://github.com/mongodb/mongo-python-driver) so you can use it like you use to.
**code example**
```python
from qwhale_client import APIClientTOKEN = ""
client = APIClient(TOKEN)
with client as database:
print(client.activated) # -> True
database["test"].insert_one({"key": "value", "extra": "123456"})
document = database["test"].find_one({"key": "value"})
print(document) # -> {"_id": ObjectId(...), "key": "value", "extra": "123456"}print(client.activated) # -> False
```**Another code example**
```python
from qwhale_client import APIClientTOKEN = ""
client = APIClient(TOKEN)
database = client.get_database()
print(client.activated) # -> Truedatabase["test"].insert_one({"key": "value", "extra": "123456"})
document = database["test"].find_one({"key": "value"})
print(document) # -> {"_id": ObjectId(...), "key": "value", "extra": "123456"}print(client.close()) # -> {'data_saved': True}
print(client.activated) # -> False
```