Sinisterly
Python connection with cookies [help] - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Python (https://sinister.li/Forum-Python)
+--- Thread: Python connection with cookies [help] (/Thread-Python-connection-with-cookies-help)



Python connection with cookies [help] - Guxi - 12-24-2012

Hey guys first of all merry christmas

I need lil' help with my python program. If you know anything that would help or if YOU could help me personally that would be great!

I am trying to make program that will connect to a website ( facebook ) with cookies that should be extracted from browser ( cookies of facebook login session ).

After it's connected to facebook with cookies ( so it's logged in ), it should extract it's source.


1. How to extract cookies from browser
2. How to connect to a website with those extracted cookies
3. How to copy the source of website
(Also would it be possible to use html array to python array?)

Plese leave suggestions/links or pm me if you can help me more.
Thanks! Smile


RE: Python connection with cookies [help] - emad.shaaban92 - 01-07-2013

Well this sort of tasks is easy in python
you will use some urllib,urllib2, cookielib to handle requests responses and cookies
to make parsing fun you may use BeautifulSoup .

Also you can read the code of this project as a working example
https://github.com/emadshaaban92/edx-downloader

Ah I forgot an important note
this way you will ignore javascript, what i mean is that you will get the html source before running any javascript code on it

if you have to handle JS too, consider using QT/GTK webkit or Selenium .

Good Luck Smile