If anyone came here from python-graphql client looking for a solution to pass an object as variable here's what I used:
query = """
{{
pairs(block: {block} first: 200, orderBy: trackedReserveETH, orderDirection: desc) {{
id
txCount
reserveUSD
trackedReserveETH
volumeUSD
}}
}}
""".format(block=''.join(['{number: ', str(block), '}']))
query = gql(query)
Make sure to escape all curly braces like I did: "{{", "}}"