Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,7 +40,7 @@ img {margin-bottom: -8px;}
|
|
| 40 |
<div class="w3-col">
|
| 41 |
<h1 class="w3-jumbo"><b>WatchTower 🐦🚧</b></h1>
|
| 42 |
<h1 class="w3-xxxlarge w3-text-blue"><b>Remove Unfavorable Tweets From Your Feed </b></h1>
|
| 43 |
-
<p><span class="w3-xlarge">Scroll down to use WatchTower 1.0. ⬇ </span> WatchTower is a tool that identifies hate speech, misinformation, and extremist content and blocks/ mutes it from your Twitter feed. WatchTower blocks content based on it's current database, so make sure to come back regullary to ensure you're up to date! WatchTower is simple to use: first scroll down the page and click the 'sign in with Twitter' button, then you'll be taken to the Twitter website and asked to verify yourself, after this you'll be taken back here, then simply scroll down to the botton of the page and click run!</p>
|
| 44 |
<a href="https://www.watchtower.cartographer.one/"><button class="w3-button w3-light-grey w3-padding-large w3-section " onclick="document.getElementById('download').style.display='block'">
|
| 45 |
<i class=""></i> Find Out More! 💬
|
| 46 |
</button></a>
|
|
@@ -147,7 +147,7 @@ def block_user(user_id, user, reason):
|
|
| 147 |
attempts = 0
|
| 148 |
blocked = True
|
| 149 |
while not finished:
|
| 150 |
-
|
| 151 |
try:
|
| 152 |
print("preparing to block {}".format(user_id))
|
| 153 |
client.block(target_user_id=user_id)
|
|
@@ -156,6 +156,13 @@ def block_user(user_id, user, reason):
|
|
| 156 |
try:
|
| 157 |
client.mute(target_user_id=user_id)
|
| 158 |
print("Could not block, so muted")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
except tweepy.errors.BadRequest as e:
|
| 160 |
print("bad request error")
|
| 161 |
print(e)
|
|
|
|
| 40 |
<div class="w3-col">
|
| 41 |
<h1 class="w3-jumbo"><b>WatchTower 🐦🚧</b></h1>
|
| 42 |
<h1 class="w3-xxxlarge w3-text-blue"><b>Remove Unfavorable Tweets From Your Feed </b></h1>
|
| 43 |
+
<p><span class="w3-xlarge">Scroll down to use WatchTower 1.0. ⬇ </span> WatchTower is a tool that identifies hate speech, misinformation, and extremist content and blocks/ mutes it from your Twitter feed. WatchTower blocks content based on it's current database, so make sure to come back regullary to ensure you're up to date! Depending on how many users WatchTower is blocking/ muting it can take upwards of 15 minutes to complete - just leave this page open, grab a cup of tea, and come back in a few minutes. WatchTower is simple to use: first scroll down the page and click the 'sign in with Twitter' button, then you'll be taken to the Twitter website and asked to verify yourself, after this you'll be taken back here, then simply scroll down to the botton of the page and click run!</p>
|
| 44 |
<a href="https://www.watchtower.cartographer.one/"><button class="w3-button w3-light-grey w3-padding-large w3-section " onclick="document.getElementById('download').style.display='block'">
|
| 45 |
<i class=""></i> Find Out More! 💬
|
| 46 |
</button></a>
|
|
|
|
| 147 |
attempts = 0
|
| 148 |
blocked = True
|
| 149 |
while not finished:
|
| 150 |
+
attempts = 0
|
| 151 |
try:
|
| 152 |
print("preparing to block {}".format(user_id))
|
| 153 |
client.block(target_user_id=user_id)
|
|
|
|
| 156 |
try:
|
| 157 |
client.mute(target_user_id=user_id)
|
| 158 |
print("Could not block, so muted")
|
| 159 |
+
except tweepy.errors.TooManyRequests as e:
|
| 160 |
+
if attempts == 0:
|
| 161 |
+
time.sleep(900)
|
| 162 |
+
attempts = attempts + 1
|
| 163 |
+
else:
|
| 164 |
+
finished = True
|
| 165 |
+
blocked = False
|
| 166 |
except tweepy.errors.BadRequest as e:
|
| 167 |
print("bad request error")
|
| 168 |
print(e)
|