1
import requests

url = "https://sameer-kumar-aztro-v1.p.rapidapi.com/"

querystring = {"sign":"aquarius","love":"today"}

headers = {
    'x-rapidapi-key': "sds",
    'x-rapidapi-host': "sameer-kumar-aztro-v1.p.rapidapi.com"
    }

response = requests.request("POST", url, headers=headers, params=querystring)

print(response.text])

Hi , this is my code

Output is

{"date_range": "Jan 20 - Feb 18", "current_date": "June 12, 2021", "description": "Nobody seems to have their lives ordered as well as you do today -- but what else is new? You should see if you can find the time to reach out and help those closest to you, but don't break your back!", "compatibility": "Taurus", "mood": "Thoughtful", "color": "Yellow", "lucky_number": "97", "lucky_time": "8am"}

i want to print "date_range" or "compatibility" . how to print ?

1 Answer 1

1

request allows us to get a json decoded response by doing

data = response.json()

Then you can access it as dictionary in python.

print(data["data_range"])

Relevant documentation: https://2.python-requests.org/en/master/user/quickstart/#json-response-content

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.