top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Pycurl and network connection's problem

0 votes
287 views

I am having problems with pycurl in my threads , when i run it , it does correctly but some times the connection has been established but nothing will be downloaded and the threads stay alive without doing any thing (especially when the network's speed is slow and has aborted status) .

I can't use TIMEOUT because i don't have the max time for downloading. How can i solve this problem in python

posted Jul 31, 2013 by Amit Parthsarthi

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

So you want to wait hours/days/years for a failed download? You should always set a timeout that is sane. If you anticipate network slowness, then set your timeout to something larger like 2-3 minutes. IIRC, the timeout only affects connection establishment so that will not help out your use case but I want to emphasize that you always want a timeout to be set.

Pycurl has an option for LOW_SPEED_LIMIT/LOW_SPEED_TIME which should allow you to set a minimum transfer speed which will abort the transfer. This should solve your problem where the connection is created but nothing is being downloaded.

See: http://stackoverflow.com/questions/4960021/handle-pycurl-hang-on-twitter-streaming-api

answer Jul 31, 2013 by Salil Agrawal
Similar Questions
+1 vote

I have a script-service running on a remote server, listening on a specific port. What i need here is to make this also maintain a log file of ALL incoming connections.

Could someone suggest to me a simple codefunction example to implement that on my main running service?

+2 votes

I defined function Fatalln in "mydef.py" and it works fine if I call it from "mydef.py", but when I try to call it from "test.py" in the same folder:

import mydef
...
Fatalln "my test"

i have NameError: name 'Fatalln' is not defined, I also tried include('mydef.py') with the same result...
What is the right syntax?

+2 votes

What's the problem with Python 3.x? It was first released in 2008, but web hosting companies still seem to offer Python 2.x rather.

For example, Google App Engine only offers Python 2.7. What's wrong?...

+1 vote

I remember to avoiding to confusing compiler for header, use

// in my include file
#define MYHEADER_H
// and in others code use:
#ifndef MYHEADER_H
#include blahblah

Unfortunately, I prevent to same error, double import to python, but I don't know how to solve, Please help.

0 votes

I have a hierarchy of classes (SubA, SubAB, SubB, ..., SubBCA, SubC,...), each of which is inheriting from a chain of superclasses with a common baseclass(Sup) on top. (So far, no problem)

Now, I want to create instances of the correct subclasstype as decided by the common baseclass, like this:

i = Sup(args_allowing_the_baseclass_to_deduce_correct_subclass)

where i can be of any class except Sup itself (as decided by Sup)

Now, the problem:

How to design the __new__() and __init__() methods for the various classes in order to achieve what I want?

...