- getuseragent 0.0.7
- Навигация
- Ссылки проекта
- Статистика
- Метаданные
- Сопровождающие
- Классификаторы
- Описание проекта
- GetUserAgent — Random/Fake/Spoof Common User Agents
- Intro
- Installation
- Features
- Use Cases
- Code Examples
- Initialisation
- User-Agents Available
- Changes
- user-agent 0.1.10
- Usage Example
- Command Line Usage
- Installation
- Documentation
- Contribution
- Подробности проекта
- Ссылки проекта
- Статистика
- Метаданные
- Сопровождающие
- Классификаторы
- История выпусков Уведомления о выпусках | Лента RSS
- Загрузка файлов
- Source Distribution
- Хеши для user_agent-0.1.10.tar.gz
- Помощь
- О PyPI
- Внесение вклада в PyPI
- Использование PyPI
- Saved searches
- Use saved searches to filter your results more quickly
- License
- lorien/user_agent
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- fake-useragent
- Usage
- Experiencing issues?
- Developers
- Tests
- Changelog
- Usage Example
- История выпусков Уведомления о выпусках | Лента RSS
- Загрузка файлов
- Source Distribution
- Built Distribution
- Хеши для user_agent2-2021.12.11.tar.gz
- Хеши для user_agent2-2021.12.11-py3-none-any.whl
- Помощь
- О PyPI
- Внесение вклада в PyPI
- Использование PyPI
getuseragent 0.0.7
Get a random, popular, commonly-used user agent string. Random/fake/spoof user agents.
Навигация
Ссылки проекта
Статистика
Метаданные
Лицензия: Apache Software License
Метки getuseragent, get user agent, random user agent, fake user agent, fake useragent, random useragent, spoof useragent, spoof user agent, get useragent, useragent, user agent
Сопровождающие
Классификаторы
Описание проекта
GetUserAgent — Random/Fake/Spoof Common User Agents
Table of Contents
- GetUserAgent — Random/Fake/Spoof Common User Agents
- Intro
- Installation
- Features
- Use Cases
- Code Examples
- Initialisation
- User-Agents Available
- Combination
- Print Random User Agent From List
- Performance / Limiting
- Requests Handler
Intro
This is just a simple python module to produce a random, commonly used user agents each time. It contains 11 lists for a total of 1,100 user agents. You can choose and combine lists depending on your needs.
Installation
Assumes you have python3 installed.
Features
- Get a random user agent of Chrome, Firefox, Safari, Edge, IE, Android, iOS, Windows, Mac, Linux, Desktop, Mobile, Bots, or any combination
- User-Agents from 100 of the most commonly used
- Add requests handler prefix
- Spoofed or fake user agents
- Combine multiple user agent lists
Use Cases
- Check that your website statistics are identifying browsers correctly
- Handle bots visiting your website
- Making a security system to detect fake user agents?
Code Examples
Initialisation
Mozilla/5.0 (iPhone; CPU iPhone OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148
User-Agents Available
Each of the following lists contains 100 commonly used user agents for that software/device/system.
Sets including multiple lists:
You can combine lists and sets together. Use the + sign between list names. Duplicate lists will automatically be removed so there's only 1 of each list at most.
You can print a single random user agent like so:
You can limit the total amount of user agents in the list to save memory. The default is no limit, and each list has 100 commonly used user agents.
You can enable the option to return your user agents ready to be used with the requests module.
- Error handling
- Retrieve updated, most popular user-agents from the internet
- Better performance
- Hot-swappable lists
- Custom list(s)
- Command line arguments
- Improve Readme
Changes
1. Added individual list limits, which can be used when using one or multiple lists. For example, if you used: UserAgent("firefox+ios", limit=5) It would limit each list to 5 user agents, and two lists, bringing the total user agents 10. 2. Checks if user agent files exist. 3. Checks if user list empty in Random()
Fixed package errors, spelling mistakes
user-agent 0.1.10
This module is for generating random, valid web user agents:
Usage Example
Command Line Usage
$ ua Intel Mac OS X rv:49.0 Gecko/20100101 Firefox/49.0 ua -n chrome -e , ,
Installation
Documentation
Contribution
Подробности проекта
Ссылки проекта
Статистика
Метаданные
Лицензия: MIT License (MIT License)
Сопровождающий: Gregory Petukhov
Метки user, agent, browser, navigator
Сопровождающие
Классификаторы
- Intended Audience
- Developers
- OSI Approved :: MIT License
- OS Independent
- Python
- Python :: 2.7
- Python :: 3.3
- Python :: 3.4
- Python :: 3.5
- Python :: 3.6
- Python :: Implementation :: CPython
- Internet :: WWW/HTTP
- Software Development :: Libraries :: Python Modules
История выпусков Уведомления о выпусках | Лента RSS
Загрузка файлов
Загрузите файл для вашей платформы. Если вы не уверены, какой выбрать, узнайте больше об установке пакетов.
Source Distribution
Uploaded 4 дек. 2021 г. source
Хеши для user_agent-0.1.10.tar.gz
Хеши для user_agent-0.1.10.tar.gz
Алгоритм Хеш-дайджест SHA256 b86537cb2a9d3bda0e2afcc654ec15b383502836877a67520654acadf73f1723 Копировать MD5 39e3af475e078fa1a6811b9cbac464e9 Копировать BLAKE2b-256 b5db559a95b7cc146b269a0cc4cb7a53471ddd270ce9b29f23a5ed5e118acd4e Копировать Помощь
О PyPI
Внесение вклада в PyPI
Использование PyPI
Разработано и поддерживается сообществом Python’а для сообщества Python’а.
Пожертвуйте сегодня!PyPI», «Python Package Index» и логотипы блоков являются зарегистрированными товарными знаками Python Software Foundation.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Generator of User-Agent header
License
lorien/user_agent
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Documentation for user_agent package
What is user_agent module for?
This module is for generating random, valid web user agents:
>>> from user_agent import generate_user_agent, generate_navigator >>> from pprint import pprint >>> generate_user_agent() 'Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.3; Win64; x64)' >>> generate_user_agent(os=('mac', 'linux')) 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:36.0) Gecko/20100101 Firefox/36.0' >>> pprint(generate_navigator()) >>> pprint(generate_navigator_js())
$ ua Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:49.0) Gecko/20100101 Firefox/49.0 $ ua -n chrome -e < "oscpu": "Linux i686 on x86_64", "appName": "Netscape", "appCodeName": "Mozilla", "appVersion": "55.0.2909.25", "platform": "X11; Linux i686 on x86_64", "userAgent": "Mozilla/5.0 (X11; Linux i686 on x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2909.25 Safari/537.36" >
Run pip install -U user_agent
fake-useragent
Or if you have multiple Python / pip versions installed, use pip3 :
pip3 install fake-useragent
Usage
If you want to specify your own browser list, you can do that via the browsers argument (default is: ["chrome", "edge", "internet explorer", "firefox", "safari", "opera"] ).
You can add your own fallback string using the fallback parameter, in rare cases everything else failed:
If you will try to get unknown browser:
By default fake-useragent will use it’s local ( browsers.json ) data file as the data source.
If you don’t want to use the local data, but use the external data source to retrieve the user-agents. Set use_external_data to True :
As a fallback method fake-useragent will retrieve it's data from an external data source and stores in a cache file or when you expcility set use_external_data=True as parameter. You can trigger an update to the cache file by calling update() :
The default location of the external resource cache file is in your os temp dir, like /tmp .
You can change the temp directory by changing cache_path (mainly useful together when use_external_data is set to True).If you need to safe some attributes from overriding them in UserAgent by __getattr__ method use safe_attrs you can pass there attributes names. At least this will prevent you from raising FakeUserAgentError when attribute not found.
For example, when using fakeuseragent with injections you need to:
Please, do not use if you don't understand why you need this. This is magic for rarely extreme case.
Experiencing issues?
Make sure that you using latest version!
pip install --upgrade fake-useragent
Check version via python console:
And you are always welcome to post issues.
Please do not forget to mention the version that you are using.
Developers
Since GitHub Actions is unable to reach useragentstring.com. We can run the script below to automatically scrape the user-agent strings from the external data source. The script will copy the JSONlines file to the src/fake_useragent/data directory. Execute:
The data JSON file is part of the Python package, see pyproject.toml. Read more about Data files support.
Tests
pip install -r requirements.txt tox
Changelog
- 1.1.1 December 4, 2022
- Remove whitespaces from user agent strings, this is a patch release
- Add pkg_resource as fallback mechanism in trying to retrieve the local JSON data file
- Add importlib-metadata & importlib-resources as dependencies
- Check on specific Python version regarding the importlib resources (python v3.10 or higher) in order to have files() working
- importlib_metadata should now also work on Python version before 3.8
- Remove obsolete MANIFEST.in file
- Make the JSON Lines data file part of the Python package, data is retrieved locally
- Extend the myproject.toml file with package-data support
- Improve code quality standards using modern Python >=3.7 syntax
- Migrated to pyproject.toml build system format + syntax check
- Add additional classifiers to the toml file
- Improved tox.ini file
- Improved GitHub Actions job using pip cache
- And various small fixes
- Implement browsers argument, allowing you to override the browser names you want to use
- Fix browser listing of Internet Explorer and Edge
- Don’t depend on w3schools.com anymore
- Clean-up data (temp) file format
- Update fallback cache server URL / use JSON Lines as file format
- Move to GitHub Actions instead of Travis
- Using black Python formatter in favour of Flake
- forked
- moved s3 + cloudfront fallback to heroku.com , cuz someone from Florida did ~25M requests last month
- Minor fix docs cloudfront url
- fix w3schools.com renamed IE/Edge to Edge/IE
- moved heroku.com fallback to s3 + cloudfront
- stop testing Python3.3 and pypy
- fix useragentstring.com Can’t connect to local MySQL server through socket
- fix broken README.rst
- fixes bug use_cache_server do not affected anything
- w3schools.com _ moved to https
- verify_ssl options added, by default it is True ( urllib.urlopen ssl context for Python 2.7.9- and 3.4.3- is not supported)
- added ua.edge alias to Internet Explorer
- w3schools.com starts displaying Edge statistic
- Python 2.6 is not tested anymore
- use_cache_server option added
- Increased fake_useragent.settings.HTTP_TIMEOUT to 5 seconds
- Added custom data file location support
- Added fallback browser support, in case of unavailable data sources
- Added alias fake_useragent.FakeUserAgent for fake_useragent.UserAgent
- Added alias fake_useragent.UserAgentError for fake_useragent.FakeUserAgentError
- Reduced fake_useragent.settings.HTTP_TIMEOUT to 3 seconds
- Started migration to new data file format
- Simplified a lot 4+ years out of date code
- Better thread/greenlet safety
- Added verbose logging
- Added safe_attrs for prevent overriding by __getattr__
- Added hosted data file, when remote services is unavailable
- Raises fake_useragent.errors.FakeUserAgentError in case when there is not way to download data
- Raises fake_useragent.errors.FakeUserAgentError instead of None in case of unknown browser
- Added gevent.sleep support in gevent patched environment when trying to download data
- xxxxx .
Usage Example
История выпусков Уведомления о выпусках | Лента RSS
Загрузка файлов
Загрузите файл для вашей платформы. Если вы не уверены, какой выбрать, узнайте больше об установке пакетов.
Source Distribution
Uploaded 10 дек. 2021 г. source
Built Distribution
Uploaded 10 дек. 2021 г. py3
Хеши для user_agent2-2021.12.11.tar.gz
Хеши для user_agent2-2021.12.11.tar.gz
Алгоритм Хеш-дайджест SHA256 3a7c94a6cba52597bfca2bfd649aa690a7ae56db0884aeb19152dbfea670a987 Копировать MD5 c6b1ccf7e6518156747fea3651097c9d Копировать BLAKE2b-256 b2e21cf04cf5f990351c30e463fb2bb23c96c59252248bde37576af99c176e78 Копировать Хеши для user_agent2-2021.12.11-py3-none-any.whl
Хеши для user_agent2-2021.12.11-py3-none-any.whl
Алгоритм Хеш-дайджест SHA256 205dfcb44931d0c21adac3da1f93438741357af3c03b0f301e15bfdf40d53e66 Копировать MD5 31554f5fdf1f87e7b9d7dad08090acf2 Копировать BLAKE2b-256 a55c36129ff7d65e6ece44ce286557c601a81a66ced8c6a42b384ec2277c2d78 Копировать Помощь
О PyPI
Внесение вклада в PyPI
Использование PyPI
Разработано и поддерживается сообществом Python’а для сообщества Python’а.
Пожертвуйте сегодня!PyPI», «Python Package Index» и логотипы блоков являются зарегистрированными товарными знаками Python Software Foundation.