python request, as appropriate, get the request with parameters



  • There's an answer from the json server, using the method get-- a request for the requet library.

    The answer is:

    {'EURUSD': 1.1245, 'GBPUSD': 1.3357}
    

    Question: By the same request, but using the parameters, only the key is allowed GBPUSD I need a response from the server not in full range (not all data) but only a part.

    My code is:

    import requests
    

    adress = "http://127.0.0.1:8000/test/1"

    response = requests.get(adress)

    response_2 = requests.get(adress, params={"GBPUSD": ???}) -- ???

    result = response.json()

    Either I don't think it's the right way to get the data, but the point is, like me, to filter the data in the get-request to get the filtered data from the server (which gives me the big data in json's Vision)



  • Here's a more appropriate option:

    response = requests.get(adress, timeout=3.05)

    result = response.json()

    print(result.get. EURUSD)



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2