Git Product home page Git Product logo

user_agent's Introduction

user_agent

image

image

image

What is user_agent module for?

This module is for generating random, valid web user agents:

  • content of "User-Agent" HTTP headers
  • content of window.navigator JavaScript object

Usage Example

>>> 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())
{'app_code_name': 'Mozilla',
 'app_name': 'Netscape',
 'appversion': '5.0',
 'name': 'firefox',
 'os': 'linux',
 'oscpu': 'Linux i686 on x86_64',
 'platform': 'Linux i686 on x86_64',
 'user_agent': 'Mozilla/5.0 (X11; Ubuntu; Linux i686 on x86_64; rv:41.0) Gecko/20100101 Firefox/41.0',
 'version': '41.0'}
>>> pprint(generate_navigator_js())
{'appCodeName': 'Mozilla',
 'appName': 'Netscape',
 'appVersion': '38.0',
 'platform': 'MacIntel',
 'userAgent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Firefox/38.0'}

Command Line Usage

$ 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"
}

Installation

$ pip install -U user_agent

Documentation

Documentation is available at http://user-agent.readthedocs.org

Contribution

Use github to submit bug,fix or wish request: https://github.com/lorien/user_agent/issues

user_agent's People

Contributors

jmb0z avatar lorien avatar pawelmhm avatar

Watchers

 avatar

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.