koromodako / aionyphe Goto Github PK
View Code? Open in Web Editor NEWAsynchronous Onyphe API Client
License: MIT License
Asynchronous Onyphe API Client
License: MIT License
The OQL OR operator ?
is not correctly handled byn aionyphe and need to be manually encoded.
Example with the OQL category:datascan ?hostname:node14.onyphe.io ?hostname:node14main.onyphe.io
expecting 3 results.
Using the following code:
from asyncio import run
from aionyphe import OnypheAPIClientSession
async def main():
oql1 = 'category:datascan ?hostname:node14.onyphe.io ?hostname:node14main.onyphe.io'
oql2 = 'category:datascan %3Fhostname:node14.onyphe.io %3Fhostname:node14main.onyphe.io'
kwargs = dict(
api_key="XXX",
)
async with OnypheAPIClientSession(**kwargs) as client:
async for metadata, _ in client.search(oql1, page=1):
print("OQL1 :", metadata)
break
async for metadata, _ in client.search(oql2, page=1):
print("OQL2 :", metadata)
break
if __name__ == '__main__':
run(main())
Getting the following results:
OQL1 : {'count': 10, 'error': 0, 'max_page': 1000, 'myip': 'XXX', 'page': '1', 'status': 'ok', 'text': 'Success', 'took': 2.088, 'total': 660409285}
OQL2 : {'count': 3, 'error': 0, 'max_page': 1, 'myip': 'XXX', 'page': '1', 'status': 'ok', 'text': 'Success', 'took': 0.021, 'total': 3}
Is it possible to display the descriptive message returned by the API during error 400 ?
Sample message from the API documentation :
{
"error": 3,
"text": "Invalid API key format",
"myip": "<redacted>",
"status": "nok"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.