2

I'm using the python package requests to send requests to https://mobile.twitter.com/username/following.

At first, I encounter the exception : requests.exceptions.SSLError: [Errno 8] _ssl.c:504: EOF occurred in violation of protocol. To solve that, I follow this solution to write a SSLAdapter to specify PROTOCOL_TLSv1.

After that, I encounter another exception : requests.exceptions.SSLError: [Errno bad handshake] (-1, 'Unexpected EOF’). And, I found this, but i send request and receive data in the same process.

Maybe i have sent the requests too fast?

Community
  • 1
  • 1
stamaimer
  • 6,227
  • 5
  • 34
  • 55
  • I'm seeing this same error, not sure why yet though. – gabe. May 11 '15 at 20:33
  • @gabe. when you send request to `mobile.twitter.com` or other endpoints? – stamaimer May 12 '15 at 08:52
  • 1
    @gabe. About the second exception `requests.exceptions.SSLError: [Errno bad handshake] (-1, 'Unexpected EOF’)`, I have find the error in my program. That is there is memory leak in my program, When the memory exhausted, The program will hang on and didn't receive response any more. So the SSL protocol didn't ended as normal, and throw this exception. – stamaimer May 12 '15 at 09:06
  • Interesting @stamaimer -- I'll check for memory leaks in my program. I'm seeing the error on a completely different api (not twitter). Must be lke you say my program crashing and the SSL connection not being properly closed. Thanks for the hint! – gabe. May 21 '15 at 03:55
  • how did you solve this problem? – linuxfreak Dec 14 '15 at 16:05
  • @linuxfreak which exception do you mean? – stamaimer Dec 15 '15 at 06:01
  • I got the same exception as yours. First, I got "requests.exceptions.SSLError: [Errno 8] _ssl.c:504: EOF occurred in violation of protocol". After I set SSLAdapter to PROTOCOL_TLSv1, I got the exception "requests.exceptions.SSLError: [Errno bad handshake] (-1, 'Unexpected EOF’)". – linuxfreak Dec 15 '15 at 06:28
  • @linuxfreak To solve the first exception, you can follow [this](http://stackoverflow.com/questions/14102416/python-requests-requests-exceptions-sslerror-errno-8-ssl-c504-eof-occurred). As the second exception, I got that exception because threreis memory leak in my program. After fix that, the second exception is gone. – stamaimer Dec 15 '15 at 07:17

1 Answers1

-2

You need to install mod_ssl for apache2

ilyas Jumadurdyew
  • 883
  • 11
  • 24