Giter Club home page Giter Club logo

aionyphe's People

Contributors

koromodako avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

aionyphe's Issues

Search does not correctly handle OR operator

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}

Descriptive message not visible in Onyphe API error

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.