uasparser2 icon indicating copy to clipboard operation
uasparser2 copied to clipboard

"Failed to download cache data"

Open venantius opened this issue 12 years ago • 8 comments
trafficstars

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")

venantius avatar Jun 20 '13 18:06 venantius

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.

hamaxx avatar Jun 21 '13 08:06 hamaxx

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.

venantius avatar Jun 21 '13 20:06 venantius

Any update on alternatives or how to resolve this problem?

rodkey avatar Dec 12 '14 01:12 rodkey

Any updates?

shaptonstahl avatar Apr 28 '15 12:04 shaptonstahl

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/')

fido20 avatar Jun 19 '15 23:06 fido20

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.

shaptonstahl avatar Jun 20 '15 12:06 shaptonstahl

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.

fido20 avatar Jun 20 '15 12:06 fido20

Any updates?

jwilber avatar Oct 12 '17 20:10 jwilber