Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with parsed data object after parsing the same user agent #31

Closed
Quadric opened this issue May 28, 2020 · 1 comment
Closed

Comments

@Quadric
Copy link

Quadric commented May 28, 2020

In [1]: from device_detector import DeviceDetector

In [2]: user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.3 
   ...: 6 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36'

In [3]: result1 = DeviceDetector(user_agent).parse()

In [4]: result1.client.engine()
Out[4]: 'WebKit'

In [5]: result2 = DeviceDetector(user_agent).parse()

In [6]: result2.client.engine()
---------------------------------------------------------------------------       
AttributeError                            Traceback (most recent call last)       
<ipython-input-6-ac90275beaa1> in <module>
----> 1 result2.client.engine()

AttributeError: 'NoneType' object has no attribute 'engine'

In [7]: user_agent2 = user_agent + '1'

In [8]: result3 = DeviceDetector(user_agent2).parse()

In [9]: result3.client.engine()
Out[9]: 'WebKit'

If i parse the same user_agent again the "client" object is None

Python 3.7.7
device_detector=0.9.0

@thinkwelltwd
Copy link
Owner

thinkwelltwd commented May 28, 2020

Use the .all_details dict or the .client_<value> methods to interact with the data.

They work correctly in the .10 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants