vendredi 27 février 2015

Is there an easy way to access an authenticated web environment after manual authentication in Python?

I am not an expert in this subject, so please forgive any ineptitude in explaining what I'm trying to achieve.


There is a website from which I want to download an image regularly. I have in mind a simple operation such as the following:



while True:
urllib.urlretrieve(
"http://ift.tt/1ASfDM5",
safeFileName()
)


In order to access this website in a conventional web browser, I sign in to a login page or use an imported X.509 certificate for authentication.


In this instance, I want to download an image from a protected page. Previously, however, I've wanted to do other simple operations on other protected pages that feature different login procedures.


Now, I don't know the first thing about writing the code necessary to automatically authenticate a script to these multiple login procedures (nor do I really have the time to learn how to do this -- and to do it securely), so is there some easy way for me to do this? What I have in mind is a Python script that runs, starts up a conventional browser (ELinks, Firefox etc.) for the purposes of authentication, accesses the necessary environment information resulting from the successful authentication and then carries on to do its simple tasks, happily authenticated.


Does such an approach exist?





Aucun commentaire:

Enregistrer un commentaire