[twitter] Add removal of twitter corpses on twitter create

This commit is contained in:
Cathy Hu 2020-09-06 20:55:10 +02:00
parent d731ecae44
commit 04515dfa76

View file

@ -121,6 +121,10 @@ async def twitter_create(response: Response, hood=Depends(get_hood)):
`https://api.twitter.com/oauth/authorize?oauth_token=` `https://api.twitter.com/oauth/authorize?oauth_token=`
""" """
try: try:
# Purge Twitter corpses
for corpse in await Twitter.objects.filter(hood=hood, verified=False).all():
await corpse.delete()
# Create Twitter
request_token = await get_oauth_token( request_token = await get_oauth_token(
config['twitter']['consumer_key'], config['twitter']['consumer_key'],
config['twitter']['consumer_secret'], config['twitter']['consumer_secret'],