leumas95
leumas95

Reputation: 395

Use python to download a file from a cookie authenticated page

I have a python script that needs to download a csv file from:

https://myasx.asx.com.au/home/watchlist/download.do

The issue I have is you have to log in to the website first, It is Cookie based authentication (HTML form login).

So far I have looked at urllib2 and Requests and haven't had much luck.

Upvotes: 0

Views: 3044

Answers (1)

dannymilsom
dannymilsom

Reputation: 2406

The requests library should do what you want. You can use Session objects to persist the authentication.

To quote the request docs -

The Session object allows you to persist certain parameters across requests. It also persists cookies across all requests made from the Session instance.

Post your code if you are still experiencing problems.

Upvotes: 1

Related Questions