GreenDelta / olca-ipc.py

Mozilla Public License 2.0
29 stars 17 forks source link

Accssing Standalone Instance with olca-ipc #32

Closed RoteKekse closed 6 months ago

RoteKekse commented 6 months ago

Dear openLCA,

I have issues going through the tutorial https://greendelta.github.io/openLCA-ApiDoc/ipc/examples/pyipc_from_scratch.html

I am starting a stand alone instance: docker run -p 8080:8080 -v <path>:/app/data --rm -d gdt-server -db example --readonly false

I see it is running: grafik

I execute the example code which works (client = ipc.Client(8080) does not produce an error) until:

client.put_all(
    mass_units,
    energy_units,
    counting_units,
    mass,
    energy,
    count,
)

I printed out the response code from the library and it is a 404 First i thought it is because of the readableflag which i changed to false.

Do you have an idea? Is there a way to access the logs?

I work for a research institute and we want to integrate openLCA in our Labmanagementsystem for our scientists, so that they can already evaluate their solutions and inks when they prepare them regarding potential risks.

Thank you for your work!

Best Micha

msrocka commented 6 months ago

When you use the gdt-server, you need to use the Rest client like here: https://github.com/GreenDelta/olca-ipc.py/blob/master/tests/config.py#L10 (it should work like the normal IPC client). Alternatively, you could also use the same IPC server that is included in openLCA in a Docker container: https://github.com/GreenDelta/olca-ipc-container (then you use the normal IPC client).

RoteKekse commented 6 months ago

ok great thanks, that seems to work :)