Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bad user agent entry #9

Open
matt-slalom opened this issue Oct 27, 2022 · 7 comments · May be fixed by #10
Open

Bad user agent entry #9

matt-slalom opened this issue Oct 27, 2022 · 7 comments · May be fixed by #10

Comments

@matt-slalom
Copy link

Describe the bug
There is one random user agent that has quote marks around it. All other entries do not have quotation marks. This causes problems in some cases with downstream consumers, especially JSON parsers.

To Reproduce

from faker import Faker
from random_user_agent.params import SoftwareName, OperatingSystem
from random_user_agent.user_agent import UserAgent

software_names = [SoftwareName.CHROME.value]
operating_systems = [OperatingSystem.WINDOWS.value, OperatingSystem.LINUX.value]
user_agent_rotator = UserAgent(software_names=software_names, operating_systems=operating_systems, limit=100)
user_agents = user_agent_rotator.get_user_agents()

fake = Faker()


def random_user_agent():
    return {"user_agent": user_agent_rotator.get_random_user_agent()}


temp = set()
i = 0
while i < 1000:
    i = i + 1
    random_agent = random_user_agent()["user_agent"]
    if random_agent.startswith('"'):
        temp.add(random_agent)
for item in temp:
    print(item)

prints:

"Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US) AppleWebKit/534.12 (KHTML, like Gecko) Chrome/9.0.576.0 Safari/534.12"

Expected behavior
All user agents should be consistent and not contain quotation marks

@viktorashi
Copy link

perhaps problem with the database the lib is calling?

@viktorashi
Copy link

#10 made this for you buddy

@viktorashi viktorashi linked a pull request Jun 17, 2023 that will close this issue
@viktorashi
Copy link

###Just Looked into the source db and there's exactly 229 such instances of this of the form
..... "Chrome/49.0.2623.87" Ubuntu/15.10 (3.16.3-1ubuntu1) Epiphany/3.16.3 "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.3) Gecko/20100423 Ubuntu/10.04 (lucid) Firefox/3.6.3" Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:58.0) Gecko/20100101 Firefox/62.0" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0" .....
so ye

@viktorashi
Copy link

aparently owner is some team lead for freelancing company, ion think he has time to look over and appove my dumbass but it's been a pleasure at least trying to contribute

@viktorashi
Copy link

actually github should add a feature where you can merge pull requests by sheer user count wanting the change. hmmm but then you'd run into the bot problem and have to make it decentrelised, i'm just ramblin, GOOD NIGHT!

@Luqman-Ud-Din
Copy link
Owner

@viktorashi apologies for the delayed response. I will go ahead and review your PR in a few days and get back to you.

@viktorashi
Copy link

Damn thanks for noticin king 👑 love family whenever you can!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants