Skip to content

Instantly share code, notes, and snippets.

@chaps
Last active September 11, 2017 17:45
Show Gist options
  • Save chaps/73e475eb649e3f22b03a220e04e1b302 to your computer and use it in GitHub Desktop.
Save chaps/73e475eb649e3f22b03a220e04e1b302 to your computer and use it in GitHub Desktop.
iTexico Nova swagger response test.

Small script to test swagger endpoint response through bravado's swagger client.

Install requirements

pip install -r requirements.txt

Run the script

python testbravado.py

requests
bravado
import requests
from bravado.client import SwaggerClient
import traceback
novaswaggerurl = "http://nova-api.itexico.com/explorer/swagger.json"
def test_json_request():
""" Test the endpoint with requests library and it's json parser
"""
jsonrequest = requests.get(novaswaggerurl).json()
return jsonrequest
def test_bravado_client():
""" Test the endpoint with bravado's Swagger client.
"""
bravadotest = SwaggerClient.from_url(novaswaggerurl)
return bravadotest
pass
def main():
test_json_request()
try:
test_bravado_client()
except Exception, e:
traceback.print_exc()
print e
pass
pass
if __name__ == "__main__":
main()
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment