A very simple application to post and get jsons to a mongodb database
Project description
Telemetry
This very simple app retrieves and posts json contents to a mongodb.
Build and Install
git clone git@github.com:bendhouseart/telemetry.git
cd telemetry
poetry install
If you receive error regarding python version, change it in pyproject.toml and run poetry lock --no-update
poetry build
pip install dist/telemetry-0.1.0.tar.gz
Setup for your environment
After installing in the previous step run the setup-telemetry
command and follow the prompt:
(telemetry-LxPB_LWP-py3.11) setup-telemetry
Enter the path to the .env file (/Users/galassiae/.telemetry.env):
Enter the connection string to the mongodb database (127.0.0.1:27417):
Enter the name of the mongodb user ():
Enter the name of the database (telemetry):
Enter the name of the collection (telemetry):
Enable rate limiting? [y/n]: n
The .env file already exists
MONGO_DB_ADDRESS='127.0.0.1:27417'
MONGO_DB_USER='telemetry'
MONGO_DB_NAME='telemetry'
MONGO_DB_COLLECTION='telemetry'
TELEMETRY_RATE_LIMITING='False'
Override existing .env file? [y/n]: y
Running this app
This app can started using the start-telemetry
command after installation via pip:
start-telemetry
Or it can be run directly with:
uvicorn telemetry:app --host 0.0.0.0 --port 80
Post a JSON to the database
curl -H 'Content-Type: application/json' -d '{ "what":"myjson","its":"toogood" }' -X POST 127.0.0.1:8000/telemetry/
Additionally there are two very simple scripts that illustrate how to post and get using this app:
bash telemetry/curl_post.sh
bash telemetry/curl_get.sh
Some additional notes for interacting with the mongodb directly or starting this app
start uvicorn/run this app
uvicorn telemetry:app --host 0.0.0.0 --port 80
to get into monash/mongodb interface run
mongosh
to connect to telemetry database
first show all dbs
show dbs
select the telemetry db for use
use telemetry
and to show all items in the selected telemetry db
db.telemetry.find()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for conversiontelemetry-0.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a2307cc843a031b5bbd926d716e3d28c12fd3e559459b123ac8d0ba52163604 |
|
MD5 | ecf3d2d0769be32c38263effd7d44278 |
|
BLAKE2b-256 | f432a8738e283960500b3115cc394c367bd6ef2113f8c629997e1a939ad310de |
Hashes for conversiontelemetry-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 882c7b8f553233a5fa81eaeccfc34b5ee40c72eb7e96929dc7c27f9f0a03281d |
|
MD5 | af30d3952f2e1bc03cbe3803d8b1c35d |
|
BLAKE2b-256 | 689a7a215f4641f6477a91249d1e23dc364123b5b924b4c206279d58c3d8591a |