How to use the isbntools.app.config.add_apikey function in isbntools

To help you get started, we’ve selected a few isbntools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xlcnd / isbntools / isbntools / bin / ren.py View on Github external
def reg_apikey(service, apikey):
    """Register API-KEY."""
    try:
        config.add_apikey(service, apikey)
    except:
        pass
github xlcnd / isbntools / isbntools / bin / meta.py View on Github external
def do_pipe():
    """Read isbn from pipe."""
    if sys.stdin.isatty():
        return 1
    service, fmt, apikey = (None, None, None)
    if len(sys.argv) > 1:
        args = sys.argv[1:]
        _, service, fmt, apikey = parse_args(args)
    service = service if service else 'default'
    fmt = fmt if fmt else 'labels'
    if apikey:
        try:
            config.add_apikey(service, apikey)
        except:
            pass
    for line in sys.stdin:
        line = line.strip()
        uprint((fmtbib(fmt, meta(line, service))))
    return 0
github xlcnd / isbntools / isbntools / bin / meta.py View on Github external
def do_terminal(args=None):
    """Read isbn from terminal."""
    args = sys.argv[1:] if not args else args[1:]
    isbn, service, fmt, apikey = parse_args(args)
    if not isbn:
        raise
    service = service if service else 'default'
    fmt = fmt if fmt else 'labels'
    if apikey:
        try:
            config.add_apikey(service, apikey)
        except:
            pass
    r = meta(isbn, service)
    uprint((fmtbib(fmt, r)))
    return 0