2

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 syntax error.

Is there a way to escape this in python?

Noah
  • 1,608
  • 15
  • 31

1 Answers1

5

Python variable names and Python keyword argument names (which is what you actually need her) cannot contain $. You may be able to use the **kwargs syntax though:

client.pet.get_pets(**{"$limit": 10})
Sven Marnach
  • 574,206
  • 118
  • 941
  • 841