Skip to content

Instantly share code, notes, and snippets.

@czepluch
Created June 23, 2020 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save czepluch/5f8dbc4ee76e2dddfb82fb907273ebcb to your computer and use it in GitHub Desktop.
Save czepluch/5f8dbc4ee76e2dddfb82fb907273ebcb to your computer and use it in GitHub Desktop.
import requests
import time
def payment():
return requests.post('http://localhost:5001/api/v1/payments/0x6B175474E89094C44Da98b954EedeAC495271d0F/0xa787FA214a168Efa12aE01E9b614DE9a4D81Ccf6',
headers={ 'Content-Type': 'application/json', }, json={ 'amount': 1000000000000000 })
start = time.time()
for i in range(500):
resp = payment()
print('The payment number {} has the status code {}'.format(i, resp.status_code))
if resp.status_code != 200:
print('The status code is not 200 hence breaking off count is {}'.format(i))
break
end = time.time()
print('Time elapsed ', end - start)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment