mirror of
https://github.com/balkian/bitter.git
synced 2024-12-22 08:28:12 +00:00
Fix README
This commit is contained in:
parent
7c829ee102
commit
57eb73b53b
@ -1,4 +1,5 @@
|
|||||||
# Description
|
# Description
|
||||||
|
|
||||||
There are two parts to bitter.
|
There are two parts to bitter.
|
||||||
First of all, it is a wrapper over Python twitter that adds support for several Twitter API credentials (e.g. authorizing the same app with different user accounts).
|
First of all, it is a wrapper over Python twitter that adds support for several Twitter API credentials (e.g. authorizing the same app with different user accounts).
|
||||||
Secondly, it is a command line tool to automate several actions (e.g. downloading user networks) using the wrapper.
|
Secondly, it is a command line tool to automate several actions (e.g. downloading user networks) using the wrapper.
|
||||||
|
@ -393,7 +393,7 @@ def stream(ctx):
|
|||||||
@stream.command('get')
|
@stream.command('get')
|
||||||
@click.option('-l', '--locations', default=None)
|
@click.option('-l', '--locations', default=None)
|
||||||
@click.option('-t', '--track', default=None)
|
@click.option('-t', '--track', default=None)
|
||||||
@click.option('-f', '--file', help='File to store the stream of tweets')
|
@click.option('-f', '--file', default=None, help='File to store the stream of tweets')
|
||||||
@click.option('-p', '--politelyretry', help='Politely retry after a hangup/connection error', is_flag=True, default=True)
|
@click.option('-p', '--politelyretry', help='Politely retry after a hangup/connection error', is_flag=True, default=True)
|
||||||
@click.pass_context
|
@click.pass_context
|
||||||
def get_stream(ctx, locations, track, file, politelyretry):
|
def get_stream(ctx, locations, track, file, politelyretry):
|
||||||
@ -416,10 +416,14 @@ def get_stream(ctx, locations, track, file, politelyretry):
|
|||||||
iterator = wq.statuses.sample()
|
iterator = wq.statuses.sample()
|
||||||
else:
|
else:
|
||||||
iterator = wq.statuses.filter(**query_args)#"-4.25,40.16,-3.40,40.75")
|
iterator = wq.statuses.filter(**query_args)#"-4.25,40.16,-3.40,40.75")
|
||||||
|
try:
|
||||||
for i in iterator:
|
for i in iterator:
|
||||||
yield i
|
yield i
|
||||||
if not politelyretry:
|
if not politelyretry:
|
||||||
return
|
return
|
||||||
|
except Exception:
|
||||||
|
if not politelyretry:
|
||||||
|
raise ex
|
||||||
thishangup = time.time()
|
thishangup = time.time()
|
||||||
if thishangup - lasthangup < 60:
|
if thishangup - lasthangup < 60:
|
||||||
raise Exception('Too many hangups in a row.')
|
raise Exception('Too many hangups in a row.')
|
||||||
|
@ -155,7 +155,11 @@ def get_hashtags(iter_tweets, best=None):
|
|||||||
|
|
||||||
|
|
||||||
def read_file(filename, tail=False):
|
def read_file(filename, tail=False):
|
||||||
with open(filename) as f:
|
if filename == '-':
|
||||||
|
f = sys.stdin
|
||||||
|
else:
|
||||||
|
f = open(filename)
|
||||||
|
try:
|
||||||
while True:
|
while True:
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
if line not in (None, '', '\n'):
|
if line not in (None, '', '\n'):
|
||||||
@ -166,6 +170,9 @@ def read_file(filename, tail=False):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
finally:
|
||||||
|
if f != sys.stdin:
|
||||||
|
close(f)
|
||||||
|
|
||||||
|
|
||||||
def get_users(wq, ulist, by_name=False, queue=None, max_users=100):
|
def get_users(wq, ulist, by_name=False, queue=None, max_users=100):
|
||||||
|
Loading…
Reference in New Issue
Block a user