I\'m trying to find a way to automatically login to Facebook without browser using Python. I experimented with \"requests\" lib. Tried several ways:
URL = \'
I can say it's quite annoying to log in to Facebook without using their API. They also like to change everything so often it is quite the job to maintain the code.
I did this a while ago, but I don't think my code is up to speed with current Facebook. However it should be a useful starting-point:
https://gitorious.org/blogsmashonfb/blogsmashonfb/source/4f7ee94a56fdffe9392485df8999e340f97f4bbe:
It has two parts, a webcrawler and a Facebook-handler (the latter is what you are interested in).
One major issue you have in your code is that you must first visit Facebook, because they send you a login form with hidden elements that you need to send back.