Giter Club home page Giter Club logo

fake_user_agent's People

Contributors

10b14224cc avatar mhwgoo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

fake_user_agent's Issues

KeyError: 'chrome' Doesn't work on Python 3.9.7 / Windows 10

Traceback (most recent call last):
  File "C:\git\repo23\main.py", line 4452, in <module>
    ua = user_agent()
  File "C:\Program Files\Python39\lib\site-packages\fake_user_agent\main.py", line 132, in user_agent
    return asyncio.run(main(browser, use_tempfile))
  File "C:\Program Files\Python39\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 642, in run_until_complete
    return future.result()
  File "C:\Program Files\Python39\lib\site-packages\fake_user_agent\main.py", line 111, in main
    return random_choose(browser, data)
  File "C:\Program Files\Python39\lib\site-packages\fake_user_agent\main.py", line 97, in random_choose
    return random.choice(data[browser])
KeyError: 'chrome'

KeyError

Hi,

I recently installed fake_user_agent and have tried the following code only to get a KeyError

`from fake_user_agent import user_agent

ua = user_agent()
print(ua)`

Here is the full error:
Traceback (most recent call last):
File "C:\Users.....\PycharmProjects.............\snshop.py", line 6, in
ua = user_agent()
File "C:\Users......\virtualenvs...............\lib\site-packages\fake_user_agent\user_agent.py", line 263, in user_agent
return asyncio.run(main(browser, use_tempfile))
File "C:\Users............\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
return loop.run_until_complete(main)
File "C:\Users...............\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 646, in run_until_complete
return future.result()
File "C:\Users.............\virtualenvs........\lib\site-packages\fake_user_agent\user_agent.py", line 216, in main
return random.choice(data[browser])
KeyError: 'opera'

About fakeua

Is there any way that I can use fakeua to print random ua directly(no asking for browser name)? I want to combine fakeua into shell script.

$ echo `fakeua`
# I need to press enter here
Input a browser name or hit <enter> not to specify browser: Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1500.55 Safari/537.36

By the way, Thank you. This project is fast and great.

KeyError: 'chrome'

[myuser@XXXX]$ python3
Python 3.10.1 (main, Dec  7 2021, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from fake_user_agent.main import user_agent
>>> user_agent("chrome")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/myuser/.local/lib/python3.10/site-packages/fake_user_agent/main.py", line 132, in user_agent
    return asyncio.run(main(browser, use_tempfile))
  File "/usr/lib64/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib64/python3.10/asyncio/base_events.py", line 641, in run_until_complete
    return future.result()
  File "/home/myuser/.local/lib/python3.10/site-packages/fake_user_agent/main.py", line 111, in main
    return random_choose(browser, data)
  File "/home/myuser/.local/lib/python3.10/site-packages/fake_user_agent/main.py", line 89, in random_choose
    return random.choice(data[browser])
KeyError: 'chrome'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.