Comments (3)
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.
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.
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)
- The Package identifing galaxy gear as smartphone HOT 1
- Unable to detect device HOT 3
- add regex dependency to setup.py
- Regularly outputs "xxx does not exist" errors (0.8 from pip) HOT 5
- The following UAs crash the library (0.8 from pip) HOT 1
- Do this project have plan to support java language? HOT 1
- Regex issue while importing device_detector HOT 1
- unable to recognize salesforcemobilesdk HOT 1
- is_bot() returns True then False for the same user agent HOT 3
- Adding new yml file HOT 1
- UnicodeDecodeError HOT 3
- Detector does not seem to work in multithreaded env HOT 1
- Encoding problems on Windows computers HOT 4
- Problem with parsed data object after parsing the same user agent HOT 1
- No licence in repo HOT 2
- ZeroDivisionError when parsing some strings
- The ReadMe.md references of a device_brand_name() function
- Running on raspberry pi uses 100% cpu and takes 1 minute to complete HOT 1
- self.all_details is None (?)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from device_detector.