Post request to Overpass API Interpreter


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 (

import requests
r =‘’, data=open(‘E:/file.xml’, ‘rb’))

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();

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!