[python][facebook-sdk] Stuck on error :-> 104, 'Connection reset by peer'

237 views
Skip to first unread message

madgulw...@gmail.com

unread,
Apr 17, 2019, 10:32:28 AM4/17/19
to PythonForFacebook
Hi,

i've created one app at facebook-for developer site, (its not activated yet, since i don't have anything running as such, but i've created user-access-token on developers.facebook.com), using which the graph-api explorer is able to run the APIs and provide correct and requested fields' data.

Now the quick goal of mine, is to write python code that talks using graph-api (using the created user-access-token) and get the facebook profile fields; which are granted for this user.

the code that i've right now is: test.py

import facebook

token = "EAAOGMQdS****************sLCpg2aLmmtyZCb5jUCShL"

graph = facebook.GraphAPI(access_token=token)

resp = graph.request(url)

print resp, resp.text, resp.reason

and whenever i try to run this program, the error that comes up is:

# python test.py
Traceback (most recent call last):
  File "u.py", line 8, in <module>
    resp = graph.request(url)
  File "/usr/local/lib/python2.7/dist-packages/facebook/__init__.py", line 285, in request
    files=files,
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 426, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))

Few more details:

Trying this on ubuntu machine, with facebook-sdk:3.1.0  (version auto picked by pip) & python version is 2.7

Is there anything that i am missing to do?

Martey Dodoo

unread,
Apr 20, 2019, 4:29:29 PM4/20/19
to pythonfo...@googlegroups.com
I can't replicate your error.

What happens if you try to access https://graph.facebook.com/me/accounts directly (through a browser or curl) from the same machine? Do you get a JSON response telling you that you need an active access token?

--
You received this message because you are subscribed to the Google Groups "PythonForFacebook" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pythonforfaceb...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Martey Dodoo
Principal Developer, Mobolic
Reply all
Reply to author
Forward
0 new messages