def get_useragent():
 with open(settings.USERAGENTS, 'r') as f:
  agents = f.readlines()
  selection = random.randint(0, (len(agents) - 1))
  agent = agents[selection]
  return agent.strip()

def get_useragent ( ) : with open ( settings . USERAGENTS , 'r' ) as f : agents = f . readlines ( ) selection = random . randint ( 0 , ( len ( agents ) - 1 ) ) agent = agents [ selection ] return agent . strip ( )
uses generator to return next useragent in saved file .