1

There are 1 best solutions below

0
CodenameLambda On

The issue is in this line:

auth_message = {"action": "auth", "key": {api_key}, "secret": {secret_key}}

In Python, {something} is the syntax to create a set, which can also have multiple items: {1, 2, 3} is the set that contains only 1, 2 and 3. (here's the documentation for sets in Python).

What you probably actually want is to just reference the values directly, so

auth_message = {"action": "auth", "key": api_key, "secret": secret_key}

I assume the confusion might've come from the fact that curly braces are used to get something into a format string of the form f"here curly braces do do what you probably thought they'd do here: {3 * 4}" (this would be equal to "here curly braces do do what you probably thought they'd do here: it 12") or "the older way with .format also exists {}".format(3) (would be "the older way with .format also exists 3") - but this is only the case in string interpolations.