Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How could I access localstorage under Python requests

I found I need to send a session id x-connection-id which is stored by server side Javascript localStorage.setItem("x-connection-id")

If and only if I get this id, so that I can keep going the following request.

Any idea ?

headers = {
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36',
    'x-connect-id': 'i need it',
}

req.get('https://api.sample/api/v1//flightavailability?'+urllib.parse.urlencode(params))
like image 996
newBike Avatar asked Oct 31 '15 04:10

newBike


1 Answers

Seems like it's impossible

Local storage is specific to browser.

Local Storage is a way to store persistent data using JavaScript. It should be used only with HTML5 compatible web browser.

To access Local storage in python, a compatible browser's python API is required.

like image 171
Incerteza Avatar answered Sep 24 '22 17:09

Incerteza