def values(self, settings): value = self.value.val if self.option_used: value = user_agents.get_by_shortcut( value.lower().decode())[2].encode() return (self.key.get_generator(settings), value)
def set_user_agent(self, k): ua = user_agents.get_by_shortcut(k) if ua: self.walker.add_value( [ b"User-Agent", ua[2].encode() ] )
def values(self, settings): value = self.value.val if self.option_used: value = user_agents.get_by_shortcut(value.lower().decode())[2].encode() return self.format_header( self.key.get_generator(settings), value )
def values(self, settings): value = self.value.val if self.option_used: value = user_agents.get_by_shortcut(value.lower())[2] return ( self.key.get_generator(settings), value )
def set_user_agent(self, k): ua = user_agents.get_by_shortcut(k) if ua: self.walker.add_value( [ ".*", "User-Agent", ua[2] ] )
def test_get_shortcut(): assert user_agents.get_by_shortcut("c")[0] == "chrome" assert not user_agents.get_by_shortcut("_")
def set_user_agent(self, k): ua = user_agents.get_by_shortcut(k) if ua: self.walker.add_value([".*", "User-Agent", ua[2]])
def test_user_agent(self): r = parse_request('GET:/:r:ua') assert len(r.headers) == 1 assert r.headers[0].values(default_settings()) == ("user-agent", user_agents.get_by_shortcut('a')[2])
def test_user_agent(self): r = parse_request('GET:/:r:ua') assert len(r.headers) == 1 assert r.headers[0].values( default_settings()) == ("user-agent", user_agents.get_by_shortcut('a')[2])
def values(self, settings): value = self.value.val if self.option_used: value = user_agents.get_by_shortcut(value.lower())[2] return self.format_header(self.key.get_generator(settings), value)