vulnersCom / api

Vulners Python API wrapper
GNU General Public License v3.0
356 stars 60 forks source link

AttributeError sometimes if send many api requests #11

Closed ghost closed 5 years ago

ghost commented 5 years ago
Traceback (most recent call last):
  File "/distr/vulners/seeker.py", line 58, in get_vulns_of
    related = vulners_api.search("order:cvss.score %s %s" % (software, version), limit=20, )
  File "/usr/local/lib/python3.6/dist-packages/vulners/api.py", line 336, in search
    total = max(results.get('total'), total)
AttributeError: 'bytes' object has no attribute 'get'

How to reproduce: I called api search ~100 times with one second delay between requests. Got this error on random requets anytime. Sometimes i can get 10 errors on 100 requests, sometimes just 1. If i up delay to 10 secs - all good.

vulnersCom commented 5 years ago

What version of Vulners Lib do you use? Please, update to the latest and try again.