hamaxx / uasparser2

Fast and reliable User Agent parser for python
Other
31 stars 13 forks source link

"Failed to download cache data" #2

Open venantius opened 11 years ago

venantius commented 11 years ago

I'm frequently having issues around failing to download cache data and I'm not really sure what the root cause is. Sometimes it works, sometimes it doesn't. Do you have any leads on what tends to drive this? I was having the error masked by the try, catch clauses surrounding the lines in question and couldn't tell if it was being driven primarily by local permissioning issues or by an inability to get remote data.

Stacktrace follows in case you're curious:

Traceback (most recent call last):
  File "PRO-559_runner.py", line 106, in <module>
    main(sys.argv[1:])
  File "PRO-559_runner.py", line 91, in main
    ua_parser = UASparser('./', 10000)
  File "/Users/jarvis/.virtualenvs/ak-sci-env/lib/python2.7/site-packages/uasparser2/__init__.py", line 110, in __init__
    self.loadData()
  File "/Users/jarvis/.virtualenvs/ak-sci-env/lib/python2.7/site-packages/uasparser2/__init__.py", line 316, in loadData
    self.updateData()
  File "/Users/jarvis/.virtualenvs/ak-sci-env/lib/python2.7/site-packages/uasparser2/__init__.py", line 305, in updateData
    raise UASException("Failed to download cache data")
hamaxx commented 11 years ago

Hi, the problem is with http://user-agent-string.info/ which is providing the data. Since I'm often having similar problems, it would probably make sense to include data with the library.

venantius commented 11 years ago

Yeah, that would be nice. Dunno how you'd want to approach the cache size issue but including even a relatively small cache file with the library would be pretty swell.

rodkey commented 9 years ago

Any update on alternatives or how to resolve this problem?

shaptonstahl commented 9 years ago

Any updates?

fido20 commented 9 years ago

You can use http://data.udger.com/example/udgerdata_old.ini, eg.

>>> from uasparser2 import UASparser >>> UASparser.ini_url = 'http://data.udger.com/example/udgerdata_old.ini' >>> uasparser = UASparser(cache_dir='/tmp/')

shaptonstahl commented 9 years ago

Thanks, fido20, but I'm still getting an error:

Traceback (most recent call last): File "<pyshell#8>", line 1, in uasparser = UASparser(cache_dir='./tmp') File "build\bdist.win-amd64\egg\uasparser2\decorators.py", line 18, in new_func return func(_args, _kwargs) File "build\bdist.win-amd64\egg\uasparser2\uasparser.py", line 146, in init super(UASparser, self).init(_args, _kwargs) File "build\bdist.win-amd64\egg\uasparser2\uasparser.py", line 49, in init self._load_data() File "build\bdist.win-amd64\egg\uasparser2\uasparser.py", line 137, in _load_data self._load_cache() File "build\bdist.win-amd64\egg\uasparser2\uasparser.py", line 102, in _load_cache self.update_data() File "build\bdist.win-amd64\egg\uasparser2\uasparser.py", line 120, in update_data raise UASException("Failed to download cache data") UASException: Failed to download cache data

Also, the udgerdata_old.ini file seems awfully small to contain parsing info.

fido20 commented 9 years ago

You must overwrite value of UASparser.ini_url before creating object uasparser = UASparser(cache_dir='./tmp') or just fork this repo, and change this in source.

jwilber commented 7 years ago

Any updates?