Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# ready to output
kind_of = type(thing)
if kind_of == str_type:
# user or tweet IDs
print(thing, file=fh)
log.info("archived %s" % thing)
elif 'id_str' in thing:
# tweets and users
if (args.format == "json"):
print(json.dumps(thing), file=fh)
elif (args.format == "csv"):
csv_writer.writerow(get_row(thing))
elif (args.format == "csv-excel"):
csv_writer.writerow(get_row(thing, excel=True))
log.info("archived %s", thing['id_str'])
elif 'woeid' in thing:
# places
print(json.dumps(thing), file=fh)
elif 'tweet_volume' in thing:
# trends
print(json.dumps(thing), file=fh)
elif 'limit' in thing:
# rate limits
t = datetime.datetime.utcfromtimestamp(
float(thing['limit']['timestamp_ms']) / 1000)
t = t.isoformat("T") + "Z"
log.warning("%s tweets undelivered at %s",
thing['limit']['track'], t)
if args.warnings:
print(json.dumps(thing), file=fh)
line_count += 1
# ready to output
kind_of = type(thing)
if kind_of == str_type:
# user or tweet IDs
print(thing, file=fh)
log.info("archived %s" % thing)
elif 'id_str' in thing:
# tweets and users
if (args.format == "json"):
print(json.dumps(thing), file=fh)
elif (args.format == "csv"):
csv_writer.writerow(get_row(thing))
elif (args.format == "csv-excel"):
csv_writer.writerow(get_row(thing, excel=True))
log.info("archived %s", thing['id_str'])
elif 'woeid' in thing:
# places
print(json.dumps(thing), file=fh)
elif 'tweet_volume' in thing:
# trends
print(json.dumps(thing), file=fh)
elif 'limit' in thing:
# rate limits
t = datetime.datetime.utcfromtimestamp(
float(thing['limit']['timestamp_ms']) / 1000)
t = t.isoformat("T") + "Z"
log.warning("%s tweets undelivered at %s",
thing['limit']['track'], t)