Skip to content
CodeKruPro

Query parameters with requests

QuizEasy-MediumPython onlyAsked in: Capgemini, Wipro

What URL does this call send?

requests.get("https://api.example.com/products",
             params={"q": "red shoes & bags", "page": 2}, timeout=10)
  • https://api.example.com/products?q=red+shoes+%26+bags&page=2
  • https://api.example.com/products?q=red shoes & bags&page=2
  • https://api.example.com/products with the parameters in the body
  • The call fails because values may not contain spaces

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in