EnzymeML / PyEnzyme

🧬 - Data management and modeling framework based on EnzymeML.
BSD 2-Clause "Simplified" License
21 stars 9 forks source link

How to send in omex archives to enzymemL read #44

Closed StephanM87 closed 2 years ago

StephanM87 commented 2 years ago

I have trouble with sending in EnzymeMl documents:

If I send a enzymeml document, which was before generated by Pyenzmye with the following code:

def test_request():
    files = {"omex_archieve":open("tests/enzml.omex", "rb")}

    req = requests.post("http://127.0.0.1:5000/read", files=files)

   print(req.text)

The request I get is :

{"detail":[{"loc":["body","omex_archive"],"msg":"field required","type":"value_error.missing"}]}

based on the documentation of the REST API, I have to send in the omex archieve as multiform/form-data correct?!

grafik

Do you have an idea, why the exception in called and what I'm doing wrong with the type?

JR-1991 commented 2 years ago

Thanks for the issue Stephan! Looking at your code, the error may result from a typo - You spelled it omex_archieve when it should be omex_archive:

# Correct
files = {"omex_archive":open("tests/enzml.omex", "rb")}

Also tested it with the following code and a random OMEX to verify on our official REST-API that runs the current Docker image:

response = requests.post(
    "https://enzymeml.sloppy.zone/read",
    files={"omex_archive": open("Simulated.omex", "rb")}
).json()

Out:

{'name': 'Simple_Menten',
 'level': 3,
 'version': 2,
 'creators': {},
 'vessels': {'v0': {'name': 'Tube',
   'volume': 10.0,
   'unit': 'ml',
   'constant': True,
   'meta_id': 'METAID_V0',
   'id': 'v0'}},
 'proteins': {'p0': {'name': 'Protein',
   'meta_id': 'METAID_P0',
   'id': 'p0',
   'vessel_id': 'v0',
   'init_conc': 100.0,
   'constant': True,
   'boundary': False,
[...]
StephanM87 commented 2 years ago

@JR-1991, thank you! I think this solved a problem, and it works now with the example from It works with the example archive : https://github.com/EnzymeML/PyEnzyme/blob/main/examples/Basic%20example/My_Experiment.omex

Nevertheless, when I upload the omex archive which was generates with the Pyenzyme REST-API, I get a stauts code 200 but still the error:

"AttributeError: BIOCHEMICAL_REACTION"

I attached the omex archive as google drive link:

https://drive.google.com/file/d/1xdySm5CE9FmcrpV6fYtus4RTO1kqKxwF/view?usp=sharing

Could you help and check out if you can see what went wrong?

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 2 years ago

This issue was closed because it has been inactive for 14 days since being marked as stale.