pip install -r requirements.txt
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 |