That said, you can still achieve what you want a slightly different way. Your Pi needs to be a web server; you could use a library such as Python's Flask to serve up a simple web API. Then your client-side scripts can simply send a request to your Pi server, which then fetches the data through Python. A trivial example would be as follows:
from flask import Flask
app = Flask(__name__)
humidity = get_humidity_through_python()
The implementation is for you to do what you like; the code simply illustrates the point that you can serve a web page from a server in this fashion.