最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How could I access localstorage under Python requests - Stack Overflow

programmeradmin2浏览0评论

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('/api/v1//flightavailability?'+urllib.parse.urlencode(params))

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))
Share Improve this question asked Oct 31, 2015 at 4:31 newBikenewBike 15k29 gold badges118 silver badges204 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

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 patible web browser.

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

发布评论

评论列表(0)

  1. 暂无评论