On 04/01/2015 17:03, Ole Andreas Gløersen wrote:
I want to enter text msg and upload picture (so all friends can see and some
private pictures) to my Facebook acount.
I'm working with fbconsole (it's important that it is text based command line)
for setting up cron job on a Raspberry Pi.
My code:
import fbconsole
redirect_uri = "https://local.fbconsole.com:8080/"
fbconsole.SITE_URL=redirect_uri
fbconsole.APP_ID = 'my_SW_ID'
fbconsole.AUTH_SCOPE = ['read_stream']
fbconsole.automatically_authenticate('my_FB_ID','my_FB_PWD','Security_code',fbconsole.SITE_URL,True)
My result:
pi@raspberrypi ~/facebook $ python f.py
send: 'GET
/dialog/oauth?scope=read_stream&state=Deletet....Deletet....&redirect_uri=https%3A%2F%2Flocal.fbconsole.com%3A8080%2F&client_id=Deletet....
HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: www.facebook.com\r\nConnection:
close\r\nUser-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615
Fedora/3.0.1-1.fc9 Firefox/3.0.1\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Pragma: no-cache
header: Facebook-API-Version: v2.2
header: X-Frame-Options: DENY
header: Cache-Control: private, no-cache, no-store, must-revalidate
header: Expires: Sat, 01 Jan 2000 00:00:00 GMT
header: X-XSS-Protection: 0
header: X-Content-Type-Options: nosniff
header: Content-Type: text/html; charset=utf-8
header: X-FB-Debug: Deletet.............Deletet....
header: Date: Sun, 04 Jan 2015 16:51:31 GMT
header: Connection: close
Traceback (most recent call last):
File "f.py", line 13, in <module>
fbconsole.automatically_authenticate('Deletet....','Deletet....','Deletet....',fbconsole.SITE_URL,True)
File "/usr/local/lib/python2.7/dist-packages/fbconsole.py", line 413, in
automatically_authenticate
browser.select_form(nr=0)
File "/usr/local/lib/python2.7/dist-packages/mechanize/_mechanize.py", line
524, in select_form
raise FormNotFoundError("no form matching "+description)
mechanize._mechanize.FormNotFoundError: no form matching nr 0
pi@raspberrypi ~/facebook $
Can anyone help me futher on?
Maybe
http://stackoverflow.com/questions/10507169/using-python-requests-to-select-forms
failing which work your way down the remaining 816 hits on google after
searching for the entire FormNotFoundError line :)
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
--
https://mail.python.org/mailman/listinfo/python-list