Coder Social home page Coder Social logo

Comments (3)

thinkwelltwd avatar thinkwelltwd commented on July 16, 2024

device_detector.py is not supposed to be "run". Are you following the Usage Notes?

Please include the python version you're using, and the exact code you're executing.

from device_detector.

michaelfrank1 avatar michaelfrank1 commented on July 16, 2024

I probably don't have a grasp on what I'm supposed to be running. I am a NOOB to Python, even though I am starting to develop Python test tools for a living.

All I am doing is running the following at the command prompt:
python device_detector.py

Which you indicated is not the way to run it.

I looked at the Usage Notes, but all I see is the results of running the tool.

Could you please provide me with some guidance. I don't want to keep bugging you about this.

It's probably very easy to run in your eyes, but I am a bit confused.

Please let me know how I am supposed to run this script so that I get results.

Thank you.

BTW: My python version is 3.8.5.

from device_detector.

thinkwelltwd avatar thinkwelltwd commented on July 16, 2024

All I am doing is running the following at the command prompt:
python device_detector.py
Could you please provide me with some guidance.

device_detector is a library to use in your own scripts, not a self-standing script. The Usage Notes are all the guidance that I can provide. Python fluency has to come from other sources.

Open your python interpreter and paste the following lines (from the Usage Notes)

from device_detector import DeviceDetector

ua = 'Mozilla/5.0 (Linux; Android 4.3; C5502 Build/10.4.1.B.0.101) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.136 Mobile Safari/537.36'
device = DeviceDetector(ua).parse()
device.all_details

If you want to parse a file of UA strings, you'll have to write your own python script to do it. Something like so:

ua_parser.py

#!/usr/bin/env python3
from device_detector import DeviceDetector

with open('/path/to/ua/strings.txt', 'r'): as ua_file:
    for ua in ua_file:
        dd = DeviceDetector(ua.strip()).parse()
        print(dd.all_details)

And with that, I'll close the ticket as this is not a bug. Thanks for checking out device_detector and all the best in learning python.

from device_detector.

Related Issues (20)

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.