NAME__
NAME__

Reputation: 633

Python Simulate jQuery on webpage

Hello once again stackoverflow community. I have yet another question for something I am working on. Currently, in Python, I'm working on a simple chat bot to expand my knowledge of Python. On the website I am testing it on, it appears they use entirely jQuery for their chat box.

For example, the jQuery that allows submitting text in their chat-box looks like this:

("#chat_speak").on("click",function(){CurrentChat.chat_say()})

How could I, preferably using the requests library, simulate a function such as 'CurrentChat.chat_say()', or, figure out what POST request to send to achieve the same result as this function would.

Any help on this issue is appreciated, thanks.

Upvotes: 0

Views: 247

Answers (1)

Blender
Blender

Reputation: 298196

Requests is just a really nice HTTP library. It doesn't execute JavaScript, so there's no way for it to actually do this.

You'll need to use another HTTP library that supports JavaScript, like Ghost.py, which is a headless WebKit browser.

Upvotes: 2

Related Questions