Questions tagged [bravado]

Python client for Swagger 2.0 services with dynamic API calls generation.

Homepage: https://bravado.readthedocs.io/en/stable/index.html

9 questions
8
votes
2 answers

Helper to create a dynamic Ruby OpenAPI/Swagger client to a REST API

I used Bravado to create a Python client to a REST API for the petstore. I need to do the same to get a dynamic Ruby client to the REST API. I saw a list of tools in the OS integrations Swagger page but most of them seems to be to automate tests…
user3313834
  • 7,327
  • 12
  • 56
  • 99
3
votes
2 answers

how to add authorization headers to bravado-created API client

I am able to create a simple API interface using the requests module that authenticates correctly and receives a response from an API. However, when I attempt to use bravado, to create the client from a swagger file, and manually add an…
rmg
  • 1,009
  • 16
  • 31
2
votes
0 answers

Is it possible for sphinx autodoc to deal with dynamic attributes?

I'm using Bravado to generate an API client for an OpenAPI endpoint. I've extended the SwaggerClient to deal with some pagination issues. The client overrides __getattr__ and __dir__, so any instantiated client will provide attributes mapping to…
user3761100
  • 553
  • 1
  • 4
  • 5
2
votes
1 answer

Requests / bravado 302 response to POST turns into GET (python)

As I was writing a handler for a webservice in bravado (through a request.session()) I came across this peculiarity: A POST request turns into a GET request as it's being redirected. Causing my POST to be mangled and I can not get the thing to…
2
votes
1 answer

Python escape '$' character in variable name

I'm using bravado, which has created functions for me to call based on a swagger definition. The swagger definition contains query parameters prefixed with $. I.e. client.pet.get_pets($limit=10). Problem is, I can't use $limit=10 because it throws a…
Noah
  • 1,608
  • 15
  • 31
1
vote
0 answers

mock any interaction with a mock object uniformly?

https://bravado.readthedocs.io/en/stable/testing.html demonstrates that one can Mock a specific endpoint of an OpenAPI client as so: def test_get_available_pet_photos(mock_client): mock_client.pet.findPetsByStatus.return_value.response =…
LeanMan
  • 474
  • 1
  • 4
  • 18
1
vote
1 answer

Can I wrap a python object to catch exceptions?

I would like to wrap an object generically enough to catch an exception on all methods. Lets suppose I have this class: class CanThrowException: def not1(self, param): if param == 1: raise ValueError('Parameter value cannot…
Leandro Cofre
  • 193
  • 1
  • 1
  • 7
1
vote
0 answers

Accessing the BitMEX Api using Swagger, Bravado & Python 3

I'm trying to connect to BitMEX using Swagger. I've written the following integration with Bravado, but I keep getting errors, no matter what I do. from bravado.client import SwaggerClient client =…
cjm2671
  • 18,348
  • 31
  • 102
  • 161
0
votes
1 answer

Specify "streamed" response in swagger.yml to send data incrementally to a bravado client

We implemented a Python based REST service, which specifies the endpoints via Swagger. On the client side, we use the bravado library. This combination works fine for all but one endpoint. That endpoint has to return a large data set, which cannot…
Achim
  • 15,415
  • 15
  • 80
  • 144