Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83211 > unrolled thread

Probem with fbconsole

Started byOle Andreas Gløersen <ole.andreas.gloersen@gmail.com>
First post2015-01-04 09:03 -0800
Last post2015-01-04 17:13 +0000
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Probem with fbconsole Ole Andreas Gløersen <ole.andreas.gloersen@gmail.com> - 2015-01-04 09:03 -0800
    Re: Probem with fbconsole Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-04 17:13 +0000

#83211 — Probem with fbconsole

FromOle Andreas Gløersen <ole.andreas.gloersen@gmail.com>
Date2015-01-04 09:03 -0800
SubjectProbem with fbconsole
Message-ID<62fdbcf0-0c40-4fde-b018-4a0b55921fb6@googlegroups.com>
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?

[toc] | [next] | [standalone]


#83212

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-01-04 17:13 +0000
Message-ID<mailman.17375.1420391642.18130.python-list@python.org>
In reply to#83211
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web