Post request to Overpass API Interpreter

Hy,

I’m using the requests module from Pyhton because I want to send a post request to the Overpass API Interpreter. I am using Java in combination with Python.

My osm-query file (file.xml):

My pyhton file (test.py):

import requests
r = requests.post(‘http://overpass-api.de/api/interpreter’, data=open(‘E:/file.xml’, ‘rb’))
print(r.text)

If I run the script independently in Java: Right-Click → Run as Python Run, I receive the desired answer in the console, but when I call the script from my java class, I receive the following error:
Traceback (innermost last):
File “”, line 1, in ?
ImportError: no module named requests

Python call from java class:
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile(“…/test.py”);

I mention that I’ve put the requests module in the PYTHONPATH, but it still no working.

Does anyone know how to solve this error? Or another way to send a xml post request?

Thanks a lot!