-2

I have an input function

id = input("Enter your ID here: ")

and I wish to add this 'id' input into the URL address below accordingly. Is there an easy way for me to go about this?

manager_history_url = (
    "https://fantasy.premierleague.com/api/entry/'id'/history/"

I input the above and it returns a JSON decode error.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
ILE2091
  • 41
  • 4
  • 1
    manager_history_url = f"https://fantasy.premierleague.com/api/entry/{id}/history/" Regarding the JSON decode error, it's possible that there is an issue with the response from the API or the way you are decoding the JSON. Without seeing more of your code or the specific error message, it's difficult to say for certain what the issue might be. – Ayb009 Mar 11 '23 at 19:51

1 Answers1

2

You could use an f-string:

manager_history_url = f'https://fantasy.premierleague.com/api/entry/{id}/history/'
Mureinik
  • 297,002
  • 52
  • 306
  • 350