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

Cleared the zip from faulty AgentNames #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ eggs/
.eggs/
lib/
lib64/
.DS_Store
parts/
sdist/
var/
Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Random User Agents
==================

Use this command to install this forked version:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert these documentation updates. After the PR merge these changes will become part of the documentation and will misguide the developers.


```bash
pip install -e git+https://github.com/iVictory2004/random_user_agent.git#egg=random_user_agent
```

Random User Agents is a python library that provides list of user agents,
from a collection of more than 326,000+ user agents, based on filters.

Expand Down Expand Up @@ -38,9 +44,9 @@ Installation
------------

You can install random_useragent by running the following command:

pip install random_user_agent

```bash
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change. The developers will be installing the package from the PyPI and this command will not install the intended version of the package.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sowy I will, I just wanted ppl to be able to clone my fork.

pip install -e git+https://github.com/iVictory2004/random_user_agent.git#egg=random_user_agent
```
Or you can download direct from [Github](https://github.com/Luqman-Ud-Din/random_user_agent) and install it manually.


Expand Down
Binary file modified random_user_agent/data/user_agents.zip
Binary file not shown.
7 changes: 4 additions & 3 deletions random_user_agent/user_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ class UserAgent:
'popularity': [],
}

def __init__(self, limit=None, *args, **kwargs):
def __init__(self, all =False, limit=None, *args, **kwargs):
Copy link
Owner

@Luqman-Ud-Din Luqman-Ud-Din Oct 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Loading all the user agents can be achieved as follows:

user_agent_rotator = UserAgent()
user_agents = user_agent_rotator.get_user_agents()

There is no need for the all parameter. We can revert these code changes.

It's better to add an update to the README.md mentioning how can we load all the user agents.

self.user_agents = []

if all:
self.user_agents = self.load_user_agents()
return
for attribute, values in self.ATTRIBUTES_MAP.items():
setattr(self, attribute, kwargs.get(attribute, [v.lower() for v in values]))

Expand Down Expand Up @@ -51,7 +53,6 @@ def load_user_agents(self):
with zipfile.ZipFile(file_path) as zipped_user_agents:
with zipped_user_agents.open('user_agents.jl') as user_agents:
for user_agent in user_agents:

if hasattr(user_agent, 'decode'):
user_agent = user_agent.decode()

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name="random_user_agent",
version="1.0.1",
version="1.0.2",
author="Luqman-Ud-Din Muhammad",
author_email="[email protected]",
description="A package to get random user agents based filters provided by user",
Expand Down