Up to date simple useragent faker with real world database

Overview

fake-useragent

info: Up to date simple useragent faker with real world database
https://landscape.io/github/hellysmile/fake-useragent/master/landscape.svg?style=flat

Features

Installation

pip install fake-useragent

Usage

from fake_useragent import UserAgent
ua = UserAgent()

ua.ie
# Mozilla/5.0 (Windows; U; MSIE 9.0; Windows NT 9.0; en-US);
ua.msie
# Mozilla/5.0 (compatible; MSIE 10.0; Macintosh; Intel Mac OS X 10_7_3; Trident/6.0)'
ua['Internet Explorer']
# Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; GTB7.4; InfoPath.2; SV1; .NET CLR 3.3.69573; WOW64; en-US)
ua.opera
# Opera/9.80 (X11; Linux i686; U; ru) Presto/2.8.131 Version/11.11
ua.chrome
# Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.2 (KHTML, like Gecko) Chrome/22.0.1216.0 Safari/537.2'
ua.google
# Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.13 (KHTML, like Gecko) Chrome/24.0.1290.1 Safari/537.13
ua['google chrome']
# Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11
ua.firefox
# Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:16.0.1) Gecko/20121011 Firefox/16.0.1
ua.ff
# Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:15.0) Gecko/20100101 Firefox/15.0.1
ua.safari
# Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25

# and the best one, random via real world browser usage statistic
ua.random

Notes

fake-useragent store collected data at your os temp dir, like /tmp

If You want to update saved database just:

from fake_useragent import UserAgent
ua = UserAgent()
ua.update()

If You don't want cache database or no writable file system:

from fake_useragent import UserAgent
ua = UserAgent(cache=False)

Sometimes, useragentstring.com or w3schools.com changes their html, or down, in such case fake-useragent uses heroku fallback

If You don't want to use hosted cache server (version 0.1.5 added)

from fake_useragent import UserAgent
ua = UserAgent(use_cache_server=False)

In very rare case, if hosted cache server and sources will be unavailable fake-useragent wont be able to download data: (version 0.1.3 added)

from fake_useragent import UserAgent
ua = UserAgent()

# Traceback (most recent call last):
#   ...
# fake_useragent.errors.FakeUserAgentError

# You can catch it via

from fake_useragent import FakeUserAgentError

try:
    ua = UserAgent()
except FakeUserAgentError:
    pass

If You will try to get unknown browser: (version 0.1.3 changed)

from fake_useragent import UserAgent
ua = UserAgent()
ua.best_browser
# Traceback (most recent call last):
#   ...
# fake_useragent.errors.FakeUserAgentError

You can completely disable ANY annoying exception with adding fallback: (version 0.1.4 added)

import fake_useragent

ua = fake_useragent.UserAgent(fallback='Your favorite Browser')
# in case if something went wrong, one more time it is REALLY!!! rare case
ua.random == 'Your favorite Browser'

Want to control location of data file? (version 0.1.4 added)

import fake_useragent

# I am STRONGLY!!! recommend to use version suffix
location = '/home/user/fake_useragent%s.json' % fake_useragent.VERSION

ua = fake_useragent.UserAgent(path=location)
ua.random

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 fake_useragent with injections you need to:

import fake_useragent

ua = fake_useragent.UserAgent(safe_attrs=('__injections__',))

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 -U fake-useragent

Check version via python console: (version 0.1.4 added)

import fake_useragent

print(fake_useragent.VERSION)

And You are always welcome to post issues

Please do not forget mention version that You are using

Tests

pip install tox
tox

Changelog

  • 0.1.11 October 4, 2018
    • moved s3 + cloudfront fallback to heroku.com, cuz someone from Florida did ~25M requests last month
  • 0.1.10 February 11, 2018
    • Minor fix docs cloudfront url
  • 0.1.9 February 11, 2018
    • fix w3schools.com renamed IE/Edge to Edge/IE
    • moved heroku.com fallback to s3 + cloudfront
    • stop testing Python3.3 and pypy
  • 0.1.8 November 2, 2017
    • fix useragentstring.com Can't connect to local MySQL server through socket
  • 0.1.7 April 2, 2017
    • fix broken README.rst
  • 0.1.6 April 2, 2017
    • 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)
  • 0.1.5 February 28, 2017
    • 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
  • 0.1.4 December 14, 2016
    • 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__
  • 0.1.3 November 24, 2016
    • 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
  • X.X.X xxxxxxx xx, xxxx
    • xxxxx ?????

Authors

You can visit authors page

Comments
  • Python 3.7 maximum amount of retries reached

    Python 3.7 maximum amount of retries reached

    Hello,

    I'd made an image download crawler few months ago, which worked very well. But when I try to execute my python file it shows up an error message as follows: 'fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached'

    Any help would be extremely appreciated. Thanks!

    opened by jihwan1008 27
  • Modified table class name for non-cached UserAgent

    Modified table class name for non-cached UserAgent

    It seems like the class attribute associated to the table on https://www.w3schools.com/browsers/default.asp has changed thus leading to IndexError when trying to initialize UserAgent with cache=False

    opened by Jordan9675 18
  • pyinstaller:   ModuleNotFoundError: No module named 'fake_useragent.data'

    pyinstaller: ModuleNotFoundError: No module named 'fake_useragent.data'

    Could not find local data/json file or could not parse the contents. Fallback to external resource. Traceback (most recent call last): File "fake_useragent\utils.py", line 122, in load File "importlib_resources_common.py", line 46, in wrapper File "importlib_resources_common.py", line 56, in files File "functools.py", line 874, in wrapper File "importlib_resources_common.py", line 82, in _ File "importlib_init_.py", line 127, in import_module File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 973, in _find_and_load_unlocked ModuleNotFoundError: No module named 'fake_useragent.data'

    opened by heishen666 14
  • fake_useragent.errors.FakeUserAgentError: No browser user-agent strings found for browser: chrome

    fake_useragent.errors.FakeUserAgentError: No browser user-agent strings found for browser: chrome

    Python version: 3.10.6 fake-useragent version: 0.1.14

    To reproduce:

    from fake_useragent import UserAgent
    
    ua = UserAgent()
    

    Error:

    Error occurred during loading data. Trying to use cache server file https://useragent.melroy.org/cache.json
    Traceback (most recent call last):
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 139, in load
        browsers_dict[browser_name] = get_browser_user_agents(
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 123, in get_browser_user_agents
        raise FakeUserAgentError(
    fake_useragent.errors.FakeUserAgentError: No browser user-agent strings found for browser: chrome
    Traceback (most recent call last):
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 139, in load
        browsers_dict[browser_name] = get_browser_user_agents(
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 123, in get_browser_user_agents
        raise FakeUserAgentError(
    fake_useragent.errors.FakeUserAgentError: No browser user-agent strings found for browser: chrome
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/usr/lib/python3.10/urllib/request.py", line 1348, in do_open
        h.request(req.get_method(), req.selector, req.data, headers,
      File "/usr/lib/python3.10/http/client.py", line 1282, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/usr/lib/python3.10/http/client.py", line 1328, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.10/http/client.py", line 1277, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "/usr/lib/python3.10/http/client.py", line 1037, in _send_output
        self.send(msg)
      File "/usr/lib/python3.10/http/client.py", line 975, in send
        self.connect()
      File "/usr/lib/python3.10/http/client.py", line 1447, in connect
        super().connect()
      File "/usr/lib/python3.10/http/client.py", line 941, in connect
        self.sock = self._create_connection(
      File "/usr/lib/python3.10/socket.py", line 845, in create_connection
        raise err
      File "/usr/lib/python3.10/socket.py", line 833, in create_connection
        sock.connect(sa)
    TimeoutError: timed out
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 64, in get
        urlopen(
      File "/usr/lib/python3.10/urllib/request.py", line 216, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python3.10/urllib/request.py", line 519, in open
        response = self._open(req, data)
      File "/usr/lib/python3.10/urllib/request.py", line 536, in _open
        result = self._call_chain(self.handle_open, protocol, protocol +
      File "/usr/lib/python3.10/urllib/request.py", line 496, in _call_chain
        result = func(*args)
      File "/usr/lib/python3.10/urllib/request.py", line 1391, in https_open
        return self.do_open(http.client.HTTPSConnection, req,
      File "/usr/lib/python3.10/urllib/request.py", line 1351, in do_open
        raise URLError(err)
    urllib.error.URLError: <urlopen error timed out>
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/fake.py", line 64, in __init__
        self.load()
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/fake.py", line 70, in load
        self.data_browsers = load_cached(
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 209, in load_cached
        update(path, browsers, use_cache_server=use_cache_server, verify_ssl=verify_ssl)
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 203, in update
        path, load(browsers, use_cache_server=use_cache_server, verify_ssl=verify_ssl)
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 154, in load
        jsonLines = get(
      File "/home/leonardo/Github/montecarlo-api/env/lib/python3.10/site-packages/fake_useragent/utils.py", line 87, in get
        raise FakeUserAgentError("Maximum amount of retries reached")
    fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached
    
    opened by araujo88 13
  • try/except block doesn't catch caching server access errors

    try/except block doesn't catch caching server access errors

    I'm trying to catch errors that occur when the caching server doesn't respond (see #77).

    But the existing exception handling prevents catching these (common) errors in a try/except block.

    This is a request to modify exception handling so that on such an exception program control passes to the script calling fake_useragent.

    import fake_useragent as fake_ua
    fua = fake_ua.UserAgent()
    try:
        fua.update()
    except Exception as e:
       print(f'User agent exception: {e}')
    

    Error (uncaught):

    Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11
    Traceback (most recent call last):
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1318, in do_open
        encode_chunked=req.has_header('Transfer-encoding'))
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
        self._send_request(method, url, body, headers, encode_chunked)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
        self.endheaders(body, encode_chunked=encode_chunked)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
        self._send_output(message_body, encode_chunked=encode_chunked)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
        self.send(msg)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
        self.connect()
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 936, in connect
        (self.host,self.port), self.timeout, self.source_address)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 724, in create_connection
        raise err
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/socket.py", line 713, in create_connection
        sock.connect(sa)
    socket.timeout: timed out
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fake_useragent/utils.py", line 67, in get
        context=context,
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 223, in urlopen
        return opener.open(url, data, timeout)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
        response = self._open(req, data)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
        '_open', req)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
        result = func(*args)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1346, in http_open
        return self.do_open(http.client.HTTPConnection, req)
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
        raise URLError(err)
    urllib.error.URLError: <urlopen error timed out>
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fake_useragent/utils.py", line 166, in load
        verify_ssl=verify_ssl,
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fake_useragent/utils.py", line 122, in get_browser_versions
        verify_ssl=verify_ssl,
      File "/opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/fake_useragent/utils.py", line 84, in get
        raise FakeUserAgentError('Maximum amount of retries reached')
    fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached
    
    opened by essandess 13
  • FakeUserAgentError('Error occurred during getting browser')

    FakeUserAgentError('Error occurred during getting browser')

    I'm getting this error with version 0.1.7 running on Mac OS X. It seems that the common suggestion to this is to update the version, but I think I have a version where this error should not come anymore? Any ideas?

    Traceback (most recent call last): File "/Users/mikko/dev/norway/lib/python2.7/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks result = g.send(result) File "/Users/mikko/dev/norway/lib/python2.7/site-packages/scrapy/core/downloader/middleware.py", line 37, in process_request response = yield method(request=request, spider=spider) File "/Users/mikko/dev/norway/lib/python2.7/site-packages/scrapy_fake_useragent/middleware.py", line 28, in process_request self.proxy2ua[proxy] = get_ua() File "/Users/mikko/dev/norway/lib/python2.7/site-packages/scrapy_fake_useragent/middleware.py", line 23, in get_ua return getattr(self.ua, self.ua_type) File "/Users/mikko/dev/norway/lib/python2.7/site-packages/fake_useragent/fake.py", line 139, in __getattr__ raise FakeUserAgentError('Error occurred during getting browser') # noqa FakeUserAgentError: Error occurred during getting browser

    opened by mikkokotila 12
  • browsers.json not loading on Python 3.7, 3.8 & 3.9

    browsers.json not loading on Python 3.7, 3.8 & 3.9

    Following on from https://github.com/fake-useragent/fake-useragent/issues/139 , there are still tests failing when there is no internet, but not failing on Python 3.10.

    On Python 3.9, without internet, the failures are

    [   39s] FAILED tests/test_fake.py::TestFake::test_fake_init - fake_useragent.errors.F...
    [   39s] FAILED tests/test_fake.py::TestFake::test_fake_safe_attrs - fake_useragent.er...
    [   39s] FAILED tests/test_fake.py::TestFake::test_fake_user_agent_browsers - fake_use...
    [   39s] FAILED tests/test_utils.py::TestUtils::test_utils_load - fake_useragent.error...
    [   39s] FAILED tests/test_utils.py::TestUtils::test_utils_load_use_local_file - fake_...
    

    In all cases, the log includes

    [   39s] WARNING  fake_useragent:utils.py:127 Could not find local data/json file or could not parse the contents. Fallback to external resource.
    [   39s] Traceback (most recent call last):
    [   39s]   File "/home/abuild/rpmbuild/BUILDROOT/python-fake-useragent-1.0.0-16.1.x86_64/usr/lib/python3.9/site-packages/fake_useragent/utils.py", line 120, in load
    [   39s]     ilr.files("fake_useragent.data").joinpath("browsers.json").read_text()
    [   39s]   File "/usr/lib64/python3.9/importlib/resources.py", line 147, in files
    [   39s]     return _common.from_package(_get_package(package))
    [   39s]   File "/usr/lib64/python3.9/importlib/_common.py", line 14, in from_package
    [   39s]     return fallback_resources(package.__spec__)
    [   39s]   File "/usr/lib64/python3.9/importlib/_common.py", line 18, in fallback_resources
    [   39s]     package_directory = pathlib.Path(spec.origin).parent
    [   39s]   File "/usr/lib64/python3.9/pathlib.py", line 1082, in __new__
    [   39s]     self = cls._from_parts(args, init=False)
    [   39s]   File "/usr/lib64/python3.9/pathlib.py", line 707, in _from_parts
    [   39s]     drv, root, parts = self._parse_args(args)
    [   39s]   File "/usr/lib64/python3.9/pathlib.py", line 691, in _parse_args
    [   39s]     a = os.fspath(a)
    [   39s] TypeError: expected str, bytes or os.PathLike object, not NoneType
    

    Note these errors may not be seen in CI because they will fallback to fetching the data.

    Note browsers.json is installed correctly.

    One logic problem is https://github.com/fake-useragent/fake-useragent/blob/master/src/fake_useragent/utils.py#L10

    As Python 3.7 have https://docs.python.org/3/library/importlib.resources.html , they wont try to import importlib_resources.

    The import needs to try to import files to see if it exists. That will fix Python 3.7 & 3.8, but doesnt explain why Python 3.9 is failing. It could be that Python 3.10 .files() works a bit better than Python 3.9.

    Note you can use https://pypi.org/project/pytest-socket/ to simulate no Internet.

    opened by jayvdb 11
  • Error occurred during getting browser

    Error occurred during getting browser

    I have a package that depends on fake-useragent, and recently, it's automated unittests have been failing because fake-useragent has been timing out when it tries to retrieve agents.

     File "/home/travis/build/chrisspen/howdou/.tox/py27/lib/python2.7/site-packages/fake_useragent/fake.py", line 98, in __getattr__
    
        raise FakeUserAgentError('Error occurred during getting browser')  # noqa
    

    What's causing this? Am I hitting some web resource too much, or is it a bug in fake-useragent? What can I do to minimize this or cache the results locally?

    opened by chrisspen 11
  • Application error

    Application error

    hi,auth, When the cache is emptied, UA = UserAgent () is found to have an error maximum number of connections is wrong.

    So the request address: https://fake-useragent.herokuapp.com/browsers/0.1.11, found that the prompt application error is online program crash or library move?

    opened by Voccoo 10
  • Error occurred during fetching https://www.w3schools.com/browsers/default.asp

    Error occurred during fetching https://www.w3schools.com/browsers/default.asp

    Hi,buddy,I found a bug like this: DEBUG: Error occurred during fetching https://www.w3schools.com/browsers/default.asp Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/fake_useragent/utils.py", line 67, in get context=context, File "/usr/lib64/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/usr/lib64/python2.7/urllib2.py", line 431, in open response = self._open(req, data) File "/usr/lib64/python2.7/urllib2.py", line 449, in _open '_open', req) File "/usr/lib64/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/usr/lib64/python2.7/urllib2.py", line 1258, in https_open context=self._context, check_hostname=self._check_hostname) File "/usr/lib64/python2.7/urllib2.py", line 1214, in do_open raise URLError(err) Hope to be solved,thank you

    opened by fifyrio 10
  • Outdated package in `conda-forge`

    Outdated package in `conda-forge`

    The major version release has not reflected in the conda-forge and still point to 0.1.14 with the old link to the repo: https://anaconda.org/conda-forge/fake-useragent

    The admins need to take over the ownership of the feedstock and merge the existing PRs here: https://github.com/conda-forge/fake-useragent-feedstock

    opened by arunkannawadi 0
  • Bump certifi from 2022.9.24 to 2022.12.7 in /cache_scraper

    Bump certifi from 2022.9.24 to 2022.12.7 in /cache_scraper

    Bumps certifi from 2022.9.24 to 2022.12.7.

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Heroku Free Dynos:

    Heroku Free Dynos: "fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached"

    fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached Possible Fix

    • Kindly note that the free dynos services of Heroku, a hosting provider, has stopped which is causing fake-useragent to crash for all users.
    • fake-useragent hosted one or more of its services to gather info on heroku at https://fake-useragent.herokuapp.com/browsers/0.1.11 which is eventually down after the services got stopped.

    To Developers (fake-useragent, @fake-useragent, @hellysmile): Upgrade to paid dynos asap for us to use your services, or move to a vps To Developers (rest, like me): There's nothing we can do on our sides, either wait or use some other pypi package

    opened by EmiliaDevs 11
  • HTTP Error 503: Service Unavailable

    HTTP Error 503: Service Unavailable

    Hello - i was using fake-useragent for a long time - and today suddenly i get this error message when running the program -

    Till now i used this version: fake-useragent 0.1.11 with this pull-request for using only user-agents from newest browsers: https://github.com/fake-useragent/fake-useragent/pull/122

    With that i get the error at the bottom..

    I can upgrade to fake-useragent 1.1.0 But with that the keyword num_newest_uas can not be used anymore.

    Is there any way to get only the newest useragents with 1.1.0 also? And is there any way to prevent the existing program with version 0.1.11 from suddenly crashing? I have created many executeable files using pyinstaller - and they seems to work suddenly not anymore...?

    I used this call in the past:

      ua = UserAgent(verify_ssl=False, num_newest_uas=2)
      userAgent = ua.random
    

    Why is this error suddenly appearing?

    Error occurred during loading data. Trying to use cache server https://fake-useragent.herokuapp.com/browsers/0.1.11
    Traceback (most recent call last):
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 164, in load
        browsers_dict[browser_key] = get_browser_versions(
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 143, in get_browser_versions
        raise FakeUserAgentError(
    fake_useragent.errors.FakeUserAgentError: No browsers version found for Chrome
    Traceback (most recent call last):
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 164, in load
        browsers_dict[browser_key] = get_browser_versions(
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 143, in get_browser_versions
        raise FakeUserAgentError(
    fake_useragent.errors.FakeUserAgentError: No browsers version found for Chrome
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 64, in get
        with contextlib.closing(urlopen(
      File "C:\Users\WRSPOL\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 214, in urlopen      
        return opener.open(url, data, timeout)
      File "C:\Users\WRSPOL\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 523, in open
        response = meth(req, response)
      File "C:\Users\WRSPOL\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 632, in http_response
        response = self.parent.error(
      File "C:\Users\WRSPOL\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 561, in error
        return self._call_chain(*args)
      File "C:\Users\WRSPOL\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 494, in _call_chain
        result = func(*args)
      File "C:\Users\WRSPOL\AppData\Local\Programs\Python\Python39\lib\urllib\request.py", line 641, in http_error_default
        raise HTTPError(req.full_url, code, msg, hdrs, fp)
    urllib.error.HTTPError: HTTP Error 503: Service Unavailable
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\DEV\Fiverr\ORDER\robalf\getLang.py", line 44, in <module>
        ua = UserAgent(verify_ssl=False, num_newest_uas=2)
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\fake.py", line 78, in __init__
        self.load()
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\fake.py", line 84, in load
        self.data = load_cached(
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 250, in load_cached
        update(path, use_cache_server=use_cache_server, verify_ssl=verify_ssl)
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 245, in update
        write(path, load(use_cache_server=use_cache_server, verify_ssl=verify_ssl))
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 187, in load
        ret = json.loads(get(
      File "C:\DEV\.venv\test\lib\site-packages\fake_useragent\utils.py", line 84, in get
        raise FakeUserAgentError('Maximum amount of retries reached')
    fake_useragent.errors.FakeUserAgentError: Maximum amount of retries reached
    
    opened by Rapid1898-code 6
  • add extra useragent.

    add extra useragent.

    Hi. My crawling process includes many requests and despite using a fake, my IP is still blocked. Please add more fake users like iPhone and Android devices fake user agent. For example, look at the fake useragents on this site:

    And please add the ability to delete a fake useragent from list of fake useragents; in order to prevent this fake user from being used again; and to avoid being blocked. Thankful

    opened by frida96 4
Releases(1.1.1)
  • 1.1.1(Dec 4, 2022)

  • 1.1.0(Nov 26, 2022)

  • 1.0.1(Nov 19, 2022)

    Bug fix release.

    • 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
    Source code(tar.gz)
    Source code(zip)
  • 1.0.0(Nov 18, 2022)

    Finally, a major release! Version 1.0.0 stable. I hope you like it.

    • Make the JSON Lines data file part of the Python package, data is retrieved locally
      • Extend the myproject.toml file with package-data support
    • Remove centralized caching server implementation
    • Make real unit-tests which should run reliable, fast, independent and without Internet connection
    Source code(tar.gz)
    Source code(zip)
  • 0.1.14(Nov 5, 2022)

    Changes:

    • 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
    Source code(tar.gz)
    Source code(zip)
  • 0.1.13(Nov 3, 2022)

    We have now a separate GitHub Organization for hosting the fake-useragent repo.

    Changes in 0.1.13:

    • 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
    • Deployment done via GitHub Actions as well
    • Using black Python formatter in favour of Flake
    Source code(tar.gz)
    Source code(zip)
Tutor plugin for integration of Open edX with a Richie course catalog

Richie plugin for Tutor This is a plugin to integrate Richie, the learning portal CMS, with Open edX. The integration takes the form of a Tutor plugin

Overhang.IO 2 Sep 08, 2022
A 3D Slicer Extension to view data from the flywheel heirarchy

flywheel-connect A 3D Slicer Extension to view, select, and download images from a Flywheel instance to 3D Slicer and storing Slicer outputs back to F

4 Nov 05, 2022
Sample python script for monitoring Rocketchat database and get statistics of users.

rocketchat-DB-monitoring Sample python script for monitoring Rocketchat database and get statistics of users. 1. Update python: yum check-update && yu

Mojtaba Taleghani 1 Apr 12, 2022
Code needed for hybrid land cover change analysis for NASA IDS project

Documentation for the NASA IDS change analysis Poley 10/21/2021 Required python packages: whitebox numpy rasterio rasterio.mask os glob math itertools

Andrew Poley 2 Nov 12, 2021
A redesign of our previous Python World Cup, aiming to simulate the 2022 World Cup all the way from the qualifiers

A redesign of our previous Python World Cup, aiming to simulate the 2022 World Cup all the way from the qualifiers. This new version is designed to be more compact and more efficient and will reflect

Sam Counsell 1 Jan 07, 2022
gwcheck is a tool to check .gnu.warning.* sections in ELF object files and display their content.

gwcheck Description gwcheck is a tool to check .gnu.warning.* sections in ELF object files and display their content. For an introduction to .gnu.warn

Frederic Cambus 11 Oct 28, 2022
AKSWINPOSTINIT -- AKS Windows node post provisioning initialization

AKSWINPOSTINIT -- AKS Windows node post provisioning initialization Features This is a tool that provides one-time powershell script initilization for

Ping He 3 Nov 25, 2021
A simple IDA Pro plugin to show all HexRays decompiler comments written by user

XRaysComments A simple IDA Pro plugin to show all HexRays decompiler comments written by user Installation Copy the file xray_comments.py to the plugi

Nox 20 Dec 27, 2022
The Google Assistant on a rotary phone

Google Assistant Rotary Phone Shoutout to my dad who had this idea a year ago and I'm only now getting around to doing it. Notes This is the code used

rydercalmdown 10 Nov 04, 2022
B-Pkg is a simple tool in python for installing all basic package in termux

Basic-Pkg 👉🏻 Basic-Pkg 👈🏻 B-Pkg is a simple tool in python for installing all basic package in termux This is my first tool, I hope you will like

Macgaiver 3 Oct 21, 2021
Structured, dependable legos for Starknet development.

cairomate • Structured, dependable legos for starknet development. Directory Structure contracts ├─ defi │ ├─ ChainlinkPriceOracle — "Simple price or

andreas 127 Nov 23, 2022
Unified Distributed Execution

Unified Distributed Execution The framework supports multiple execution backends: Ray, Dask, MPI and MultiProcessing. To run tests you need to install

17 Dec 25, 2022
automate some stuff so I can be more noob

dota automate some stuff so I can be more noob This is a simple project, but one that I've wanted forever! I use pyautogui, time, smtplib and datetime

Aaron Allen 17 Oct 18, 2022
A student information management system in Python

Student-information-management-system 本项目是一个学生信息管理系统,这个项目是用Python语言实现的,也实现了图形化界面的显示,同时也实现了管理员端,学生端两个登陆入口,同时底层使用的是Redis做的数据持久化。 This project is a stude

liuyunfei 7 Nov 15, 2022
A plugin for managing mod installers in Mod Organizer 2

Reinstaller v1.0.* Introduction Reinstaller allows you to conveninetly backup mod installers to re-run later, without risk of them cluttering up your

Alex Ashmore 2 Jun 27, 2022
Powerful virtual assistant in python

Virtual assistant in python Powerful virtual assistant in python Set up Step 1: download repo and unzip Step 2: pip install requirements.txt (if py au

Arkal 3 Jan 23, 2022
Arcpy Tool developed for ArcMap 10.x that checks DVOF points against TDS data and creates an output feature class as well as a check database.

DVOF_check_tool Arcpy Tool developed for ArcMap 10.x that checks DVOF points against TDS data and creates an output feature class as well as a check d

3 Apr 18, 2022
Use `forge` and `cast` commands in Python scripts

foundrycli.py ( 🔥 , 🐍 ) foundrycli.py is a Python library I've made for personal use; now open source. It lets you access forge and cast CLIs from P

Zero Ekkusu 17 Jul 17, 2022
A simple project which is a ecm to found a good way to provide a path to img_dir in gooey

ECM to find a good way for img_dir Path in Gooey This code is just an ECM to find a good way to indicate a path of image in image_dir variable. We loo

Jean-Emmanuel Longueville 1 Oct 25, 2021
RestMapper takes the pain out of integrating with RESTful APIs.

python-restmapper RestMapper takes the pain out of integrating with RESTful APIs. It removes all of the complexity with writing API-specific code, and

Lionheart Software 8 Oct 31, 2020