I'm trying to use threading in my program which checks username availability and claims available ones. The api which I check against has no rate limit, however, the one to which I claim available names has a rate limit of circa five requests.
I'm using threads on the checking function, and the checking function then directs to the creating function with self.claim(name)
for available usernames. I just want to post a single request in the create/claim while the checking function checks at around 200rq/s
class main():
# create account
# do this just once
def claim(self, user):
r = requests.post(f'https://somewebsite.com/{user}')
# check if available
# run with threads
def check(self):
r = requests.get(f'https://somewebsite.com/{name}')
if 'available' in r.text:
self.claim(name) # create acc.
# threads
def threads(self):
for i in range(150):
threading.Thread(target=self.checker, args=()).start()