I want to extract the information when the tyre from below link will be in stock. I have around 10 pages that I want to monitor by checking the availability of them.
I don’t want to use the selenium and would prefer to use requests for it.
It gets the request token by sending a POST
request StockHub/negotiate?negotiateVersion=1
After this it send web socket request.
https://www.jaxtyres.com.au/tyres/hankook/ventus-s1-evo2-k117?sku=ha2254517k117w
Error Message:
“error”:”Handshake was canceled.
Tried:
import websocket
import json
def on_message(ws, message):
print(message)
def on_error(ws, error):
print(error)
def on_close(ws, close_status_code, close_msg):
print("### closed ###")
print(f"Close status code: {close_status_code}")
print(f"Close message: {close_msg}")
def on_open(ws):
params = {
'id': 'D9lTUVj1e2K55TYd58EYJA',
}
ws.send(json.dumps(params))
if __name__ == "__main__":
websocket.enableTrace(True)
ws = websocket.WebSocketApp("wss://www.jaxtyres.com.au/StockHub",
header=headers,
on_message=on_message,
on_error=on_error,
on_close=on_close)
ws.on_open = on_open
ws.run_forever()
Can you please help?