mirror of
https://github.com/balkian/TwitterDigger.git
synced 2024-11-22 16:22:28 +00:00
Added Ctrl+C
This commit is contained in:
parent
417bfc9b10
commit
b6cb81892d
12
myego.py
12
myego.py
@ -63,6 +63,13 @@ def explore_user(t,uid):
|
|||||||
pending.add(follo)
|
pending.add(follo)
|
||||||
distance[follo] = newdist
|
distance[follo] = newdist
|
||||||
|
|
||||||
|
|
||||||
|
def signal_handler(signal, frame):
|
||||||
|
print 'You pressed Ctrl+C!'
|
||||||
|
sh.close()
|
||||||
|
sys.exit(0)
|
||||||
|
signal.signal(signal.SIGINT, signal_handler)
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
print "Iteration!"
|
print "Iteration!"
|
||||||
@ -79,6 +86,7 @@ while True:
|
|||||||
nextuser=user
|
nextuser=user
|
||||||
explore_user(t,nextuser)
|
explore_user(t,nextuser)
|
||||||
pending.remove(nextuser)
|
pending.remove(nextuser)
|
||||||
|
sh.sync()
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
except TwitterHTTPError as ex:
|
except TwitterHTTPError as ex:
|
||||||
print "Exception %s - %s" % (ex,type(ex))
|
print "Exception %s - %s" % (ex,type(ex))
|
||||||
@ -88,4 +96,8 @@ while True:
|
|||||||
except IncompleteRead:
|
except IncompleteRead:
|
||||||
print "IncompleteRead!"
|
print "IncompleteRead!"
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
|
except Exception as ex:
|
||||||
|
print "Exception"
|
||||||
|
sh.close()
|
||||||
|
raise ex
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user