Skip to content
Advertisement

Formatting a variable as a string

I am trying to create a Python program that will query a URL and produce a JSON file. I need to pass an argument in the end of the URL which comes from the SQL query.

I have imported the requests library.

I get an error message ‘TypeError: float argument required, not str’ when I am trying to pass argument in the URL.

There is only one column of result produced from the query:

Below is what I came up with:

Advertisement

Answer

Leave creating parameters to the requests framework instead:

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement