API

API connection

API connection

class CveXplore.api.connection.api_db.ApiDatabaseCollection(baseurl, collname, api_path=None, proxies=None, user_agent='CveXplore')[source]

Bases: object

The ApiDatabaseCollection mimics the behaviour of the CveSearchCollection

__init__(baseurl, collname, api_path=None, proxies=None, user_agent='CveXplore')[source]

Create a new ApiDatabaseCollection.

__repr__()[source]

return a string representation of the obj ApiDatabaseCollection

find(the_filter=None)[source]

Query the api endpoint as you would do so with a pymongo Collection.

find_one(the_filter=None)[source]

Query the api endpoint as you would do so with a pymongo Collection.

Returns:

Data or None

Return type:

object

class CveXplore.api.connection.api_db.ApiDatabaseSource(baseurl, api_path=None, proxies=None, user_agent='CveXplore')[source]

Bases: object

The ApiDatabaseSource mimics the behaviour of the MongoDBConnection.

__init__(baseurl, api_path=None, proxies=None, user_agent='CveXplore')[source]

Create new instance of the ApiDatabaseSource

__repr__()[source]

return a string representation of the obj ApiDatabaseSource

API helpers

Cve Search API

class CveXplore.api.helpers.cve_search_api.CveSearchApi(db_collection, filter=None, limit=None, skip=None, sort=None)[source]

Bases: ApiBaseClass

The CveSearchApi handles the different arguments in order to perform a query to a specific Cve Search api endpoint. It mimics the pymongo cursor’s behaviour to provide an ambiguous way to talk to either an API or a mongodb.

__init__(db_collection, filter=None, limit=None, skip=None, sort=None)[source]

Create a new CveSearchApi object.

__iter__()[source]

Make this class an iterator

__next__()

Iterate to the results and return database objects

__repr__()[source]

return a string representation of the obj GenericApi

limit(value)[source]

Method to limit the amount of returned data

next()[source]

Iterate to the results and return database objects

query()[source]

Endpoint for free query to cve search data

skip(value)[source]

Method to skip the given amount of records before returning the data

sort(field, direction)[source]

Method to sort the returned data