Skip to content

Instantly share code, notes, and snippets.

@ShahriyarR
Created April 23, 2024 19:56
Show Gist options
  • Save ShahriyarR/1fb1665d8adfeafcdf86f90459bf342e to your computer and use it in GitHub Desktop.
Save ShahriyarR/1fb1665d8adfeafcdf86f90459bf342e to your computer and use it in GitHub Desktop.
import requests
import threading
def send_request(user_id, new_email):
response = requests.post(f'http://127.0.0.1:5000/change_email/{user_id}', data={'email': new_email})
print(response.text)
# Create threads to simulate concurrent requests
thread1 = threading.Thread(target=send_request, args=('1', 'newemail1@example.com'))
thread2 = threading.Thread(target=send_request, args=('2', 'newemail2@example.com'))
thread1.start()
thread2.start()
thread1.join()
thread2.join()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment