42 lines
973 B
Markdown
42 lines
973 B
Markdown
# MineTest Python API
|
||
|
||
This code is dirty for the moment. Experimental purpose only.
|
||
|
||
## Install
|
||
|
||
Requires MineTest `blocks` table to be on PostgreSQL.
|
||
|
||
Requires `python3-psycopg2` (which requires `libpq-dev`):
|
||
|
||
sudo apt install libpq-dev
|
||
sudo pip3 install psycopg2
|
||
|
||
## Configure
|
||
|
||
Change `CONFIG_DB_CONNECT` with your PostgreSQL config string, and `CONFIG_LISTEN` with your IP and port. (leave `0.0.0.0` to listen on all addresses)
|
||
|
||
## Run
|
||
|
||
python3 getblocks.py
|
||
|
||
## Use
|
||
|
||
Beware of browsers which may replace `>` and `<` by `<` and `&rt;` in url. Use commandline instead:
|
||
|
||
curl "http://127.0.0.1:8060/z=0/x>-5/x<5/y>20/y<=30"
|
||
|
||
Response is a JSON list of the blocks of which position verifies these conditions: a rectangle of 8×9×1 blocks.
|
||
|
||
{
|
||
"blocks": [
|
||
[x, y, z, data], // data is hexadecimal form of raw binary from MineTest blocks DB
|
||
...
|
||
]
|
||
}
|
||
|
||
## License
|
||
|
||
GNU AGPL 3.0
|
||
|
||
CopyLeft 2020 Pascal Engélibert
|