Skip to content

Commit

Permalink
--profile
Browse files Browse the repository at this point in the history
An optional --profile command line argument to use the keys in a different twarc
profile.
  • Loading branch information
edsu committed Mar 19, 2023
1 parent ae7a161 commit 9f882a4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions utils/deletes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@
ORIGINAL_USER_PROTECTED = "ORIGINAL_USER_PROTECTED"
ORIGINAL_USER_SUSPENDED = "ORIGINAL_USER_SUSPENDED"

t = twarc.Twarc()
# twarc instance
t = None

def main(files, enhance_tweet=False, print_results=True, profile=None):
global t
if profile is not None:
t = twarc.Twarc(profile=profile)
else:
t = twarc.Twarc()

def main(files, enhance_tweet=False, print_results=True):
counts = collections.Counter()
for count, line in enumerate(fileinput.input(files=files)):
if count % 10000 == 0:
Expand Down Expand Up @@ -191,6 +197,10 @@ def has_error_code(resp, code):
action="store_true",
help="Skip outputting delete reason summary",
)
parser.add_argument(
"--profile",
help="The twarc API profile to use"
)
parser.add_argument(
"files",
metavar="FILE",
Expand All @@ -203,4 +213,5 @@ def has_error_code(resp, code):
args.files if len(args.files) > 0 else ("-",),
enhance_tweet=args.enhance,
print_results=not args.skip_results and not args.enhance,
profile=args.profile,
)

0 comments on commit 9f882a4

Please sign in to comment.