mirror of
https://github.com/cve-search/pyvariot.git
synced 2024-11-27 01:07:23 +00:00
fix: before is optional
This commit is contained in:
parent
52f733b386
commit
17df93bb5f
1 changed files with 8 additions and 7 deletions
|
@ -76,7 +76,8 @@ class PyVARIoT():
|
||||||
params={'jsonld': jsonld})
|
params={'jsonld': jsonld})
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
def __prepare_params(self, jsonld: bool=False, since: datetime | None=None, before: datetime | None=None,
|
def __prepare_params(self, jsonld: bool=False,
|
||||||
|
since: datetime | None=None, before: datetime | None=None,
|
||||||
limit: int | None=None, offset: int | None=None) -> dict[str, bool | str | int]:
|
limit: int | None=None, offset: int | None=None) -> dict[str, bool | str | int]:
|
||||||
'''Prepare the parameters for the requests.'''
|
'''Prepare the parameters for the requests.'''
|
||||||
params: dict[str, bool | str | int] = {'jsonld': jsonld}
|
params: dict[str, bool | str | int] = {'jsonld': jsonld}
|
||||||
|
@ -91,7 +92,7 @@ class PyVARIoT():
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def get_vulnerabilities(self, /, *, jsonld: bool=False,
|
def get_vulnerabilities(self, /, *, jsonld: bool=False,
|
||||||
since: datetime | None=None, before: datetime | None,
|
since: datetime | None=None, before: datetime | None=None,
|
||||||
limit: int | None=None, offset: int | None=None) -> dict[str, Any]:
|
limit: int | None=None, offset: int | None=None) -> dict[str, Any]:
|
||||||
'''Get vulnerabilities on an interval.
|
'''Get vulnerabilities on an interval.
|
||||||
|
|
||||||
|
@ -107,7 +108,7 @@ class PyVARIoT():
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
def get_vulnerabilities_iter(self, /, *, jsonld: bool=False,
|
def get_vulnerabilities_iter(self, /, *, jsonld: bool=False,
|
||||||
since: datetime | None=None, before: datetime | None,
|
since: datetime | None=None, before: datetime | None=None,
|
||||||
limit: int | None=None, offset: int | None=None) -> Generator[dict[str, Any], None, None]:
|
limit: int | None=None, offset: int | None=None) -> Generator[dict[str, Any], None, None]:
|
||||||
'''Get vulnerabilities on an interval, automatically iterates over all the matching vulerabilities.
|
'''Get vulnerabilities on an interval, automatically iterates over all the matching vulerabilities.
|
||||||
|
|
||||||
|
@ -126,14 +127,14 @@ class PyVARIoT():
|
||||||
if not r['next']:
|
if not r['next']:
|
||||||
break
|
break
|
||||||
next_params = dict(parse_qsl(urlparse(r['next']).query))
|
next_params = dict(parse_qsl(urlparse(r['next']).query))
|
||||||
since = datetime.fromisoformat(next_params['since'])
|
since = datetime.fromisoformat(next_params['since']) if next_params.get('since') else None
|
||||||
before = datetime.fromisoformat(next_params['before'])
|
before = datetime.fromisoformat(next_params['before']) if next_params.get('before') else None
|
||||||
limit = int(next_params['limit'])
|
limit = int(next_params['limit'])
|
||||||
offset = int(next_params['offset'])
|
offset = int(next_params['offset'])
|
||||||
jsonld = False if next_params['offset'] == 'False' else True
|
jsonld = False if next_params['offset'] == 'False' else True
|
||||||
|
|
||||||
def get_exploits(self, /, *, jsonld: bool=False,
|
def get_exploits(self, /, *, jsonld: bool=False,
|
||||||
since: datetime | None=None, before: datetime | None,
|
since: datetime | None=None, before: datetime | None=None,
|
||||||
limit: int | None=None, offset: int | None=None) -> dict[str, Any]:
|
limit: int | None=None, offset: int | None=None) -> dict[str, Any]:
|
||||||
'''Get exploits on an interval.
|
'''Get exploits on an interval.
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ class PyVARIoT():
|
||||||
return r.json()
|
return r.json()
|
||||||
|
|
||||||
def get_exploits_iter(self, /, *, jsonld: bool=False,
|
def get_exploits_iter(self, /, *, jsonld: bool=False,
|
||||||
since: datetime | None=None, before: datetime | None,
|
since: datetime | None=None, before: datetime | None=None,
|
||||||
limit: int | None=None, offset: int | None=None) -> Generator[dict[str, Any], None, None]:
|
limit: int | None=None, offset: int | None=None) -> Generator[dict[str, Any], None, None]:
|
||||||
'''Get exploits on an interval, automatically iterates over all the matching exploits.
|
'''Get exploits on an interval, automatically iterates over all the matching exploits.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue