Is there a way to check if request.history would be more than 1?

  python, python-3.x, python-requests

Imagine this, a program that lists out all the redirects that a link has (i.e a grabify link.)

Now lets say you wanted to print "yes" if there was more than 1 link pasted, how can I do that?

This is the code that I have:

import requests
import time

def nowdotheyes():
    time.sleep(1)
    print("...")
    time.sleep(3)
    responses = requests.get(link)
    for responses in responses.history:
        print(responses.url)
        if (responses.history > 1):
          print ("yes")

Source: Python-3x Questions

LEAVE A COMMENT