Home > Software design >  Get A Response From A Result (CURL)
Get A Response From A Result (CURL)

Time:12-16

I'm noobie/beginner at Python

I was creating this script

I tried to curl a URL and got a response(A) now I want to get the response(B) from that response A

result = os.popen("curl https://raw.githubusercontent.com/SirdLay/test/main/test.txt").read()
index = os.popen("curl [what to be used here?]")

CodePudding user response:

response1 = os.popen("curl https://raw.githubusercontent.com/SirdLay/test/main/test.txt").read()
url = response1[<key>] 
# key is some key in the response1.
# You can print the response1 to see the object.
# For your particular case you dont need a key.
# so you can use
url =  response1
response2 =  os.popen("curl "   url).read() 
  • Related