Why has this value not changed?

class W ():

headers = {"user-agent": UserAgent().random,}

def a(self):
    print(self.headers)
    pass

def b(self):
    print(self.headers)
    print(self.headers)
    pass
pass

aa = W ();
aa.b ()
aa.b ()

results
{"user-agent":" Mozilla/5.0 (X11; Linux x86"64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36"}
{"user-agent":" Mozilla/5.0 (X11; Linux x86"64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36"}
{"user-agent":" Mozilla/5.0 (X11; Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36"}
{"user-agent":" Mozilla/5.0 (X11; Linux x86 / 64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36"}
Why aren"t the results random?

Mar.14,2021

because of your

class W:
    headers = {"user-agent": UserAgent().random,}

will only be executed once when the class is defined, and should be replaced by

class W:
    def make_new(self):
        return {"user-agent": UserAgent().random,}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a04f-2c1e5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a04f-2c1e5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?