Q: beautifulsoup (webscraping) not updating variables when HTML text has changed I am new to python and I cant understand why this isn't working, but I've narrowed down the issue to one line of code.
The purpose of this bot is to scrape HTML from a website (using beautiful and post to discord when the text changes. I use FC2 and FR2 (flightcategory2 and flightrestrictions2) as memory variables for the code to check against every time it runs. If they're the same, the code waits for _ minutes and checks again, if they're different it posts it.
However when running this code, the variables "flightCategory" "flightRestrictions" change the first time the code runs, but for some reason stop changing when the HTML text on the website changes. the line in question is this if loop.
if 1==1: # using 1==1 so this loop constantly runs for testing, otherwise I have it set for a time
        flightCategory, flightRestrictions = und.getInfo()
       

When debugging mode, the code IS run, but the variables in the code don't update, and I am confused as to why they would update the first time the code is run, but not sequential times. This line is critical to the operation of my code.
Here's an abbreviated version of the code to make it easier to read. I'd appreciate any help.
FC2 = 0
FR2 = 0
flightCategory = ""
flightRestrictions = ""

class UND:
    def __init__(self):
        page = requests.get("http://sof.aero.und.edu")
        self.soup = BeautifulSoup(page.content, "html.parser")

    def getFlightCategory(self):    # Takes the appropriate html text and sets it to a variable
        flightCategoryClass = self.soup.find(class_="auto-style1b")
        return flightCategoryClass.get_text()

    def getRestrictions(self):  # Takes the appropriate html text and sets it to a variable
        flightRestrictionsClass = self.soup.find(class_="auto-style4")
        return flightRestrictionsClass.get_text()

    def getInfo(self):
        return self.getFlightCategory(), self.getRestrictions()

und = UND()
while 1 == 1:
    if 1==1:    #using 1==1 so this loop constantly runs for testing, otherwise I have it set for a time
        flightCategory, flightRestrictions = und.getInfo()   (scrape the html from the web)
        if flightCategory == FC2 and flightRestrictions == FR2:  # if previous check is the same as this check then skip posting
            Do Something
        elif flightCategory != FC2 or flightRestrictions != FR2:  # if any variable has changed since the last time
            FC2 = flightCategory  # set the comparison variable to equal the variable
            FR2 = flightRestrictions
            if flightRestrictions == "Manager on Duty:":  # if this is seen only output category
               Do Something
            elif flightRestrictions != "Manager on Duty:":
                Do Something
    else:
        print("Outside Time")
        time.sleep(5)  # Wait _ seconds. This would be set for 30 min but for testing it is 5 seconds. O



A: According to your code, you're only sending a request to http://sof.aero.und.edu when you're creating an instance of the UND class.
Therefore, the soup attribute of your instance is never updated during the loop and you keep on getting outdated values.
You could make it work with the following logic:
class UND:
    def __init__(self):
        pass

    def scrape(self):
        page = requests.get("http://sof.aero.und.edu")
        self.soup = BeautifulSoup(page.content, "html.parser")

    ## SOME CODE

und = UND()
while 1 == 1:
    und.scrape() # We scrape the website at the beginning of each loop iteration

    ## SOME OTHER CODE

