Bugfix: sleep() imports in community/util

This commit is contained in:
freamon 2024-05-22 12:16:35 +01:00
parent 910ba06620
commit 92cda776fa

View file

@ -1,6 +1,7 @@
from datetime import datetime, timedelta from datetime import datetime, timedelta
from threading import Thread from threading import Thread
from time import sleep from time import sleep
from random import randint
from typing import List from typing import List
import requests import requests
from PIL import Image, ImageOps from PIL import Image, ImageOps
@ -44,7 +45,7 @@ def search_for_community(address: str):
webfinger_data = get_request(f"https://{server}/.well-known/webfinger", webfinger_data = get_request(f"https://{server}/.well-known/webfinger",
params={'resource': f"acct:{address[1:]}"}) params={'resource': f"acct:{address[1:]}"})
except requests.exceptions.ReadTimeout: except requests.exceptions.ReadTimeout:
time.sleep(randint(3, 10)) sleep(randint(3, 10))
try: try:
webfinger_data = get_request(f"https://{server}/.well-known/webfinger", webfinger_data = get_request(f"https://{server}/.well-known/webfinger",
params={'resource': f"acct:{address[1:]}"}) params={'resource': f"acct:{address[1:]}"})