Skip to content

Instantly share code, notes, and snippets.

@agatsoh
Created July 9, 2019 19:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save agatsoh/77ced0c04911d2be2369c5b54930b73a to your computer and use it in GitHub Desktop.
Save agatsoh/77ced0c04911d2be2369c5b54930b73a to your computer and use it in GitHub Desktop.
import requests
import time
def payment():
return requests.post('http://localhost:5012/api/v1/payments/0x610f3c3C1998FAd6A659A9f5Bb83962DA27eAf1d/0x80Cf7AcFde7Cb110675cD7B478c167cF1A5b2f0e',
headers={ 'Content-Type': 'application/json', }, json={ 'amount': 1 })
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