How to use the isbntools.app.quiet_errors 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 / doitotex.py View on Github external
def main(doi=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    config.setsocketstimeout(TO)
    try:
        doi = sys.argv[1] if not doi else doi[1]
        data = doi2tex(doi)
        if data:
            print(data)
    except:
        usage(prefix)
github xlcnd / isbntools / isbntools / bin / cover.py View on Github external
def main(args=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    try:
        args = sys.argv[1] if not args else args[1]
        lnks = cover(args)
        for k, v in lnks.items():
            print("%s:  %s" % (k, v))
    except:
        usage(prefix)
github xlcnd / isbntools / isbntools / bin / ren.py View on Github external
def main():
    sys.excepthook = quiet_errors
    success = ren(sys.argv[1:]) if len(sys.argv) > 1 else False
    if success:
        return
    providers = list(registry.services.keys())
    if 'default' in providers:
        providers.remove('default')
    available = '|'.join(providers)
    usage(available)
github xlcnd / isbntools / isbntools / bin / ean13.py View on Github external
def main(isbn=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    try:
        isbn = sys.argv[1] if not isbn else isbn[1]
        print(ean13(isbn))
    except:
        usage(prefix)
github xlcnd / isbntools / isbntools / bin / validate.py View on Github external
def main(isbn=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    try:
        isterminal = sys.stdin.isatty()
        if not isterminal:
            return do_pipe()
        isbn = sys.argv[1] if not isbn else isbn[1]
        out = get_canonical_isbn(isbn)
        if out:
            print(out)
    except:
        return usage(prefix)
github xlcnd / isbntools / isbntools / bin / meta.py View on Github external
def main(args=None, prefix=PREFIX):
    """Metadata for a given ISBN."""
    sys.excepthook = quiet_errors
    try:
        return do_terminal(args) if sys.stdin.isatty() else do_pipe()
    except:
        providers = list(registry.services.keys())[:]
        try:
            providers.remove('default')
        except:
            pass
        available = '|'.join(sorted(providers))
        bibf = fmts[:]
        try:
            bibf.remove('labels')
        except:
            pass
        ofmts = '|'.join(sorted(bibf))
        return usage(prefix, available, ofmts)
github xlcnd / isbntools / isbntools / bin / desc.py View on Github external
def main(args=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    try:
        args = sys.argv[1] if not args else args[1]
        content = desc(args)
        content = fill(content, width=75) if content else None
        if content:
            uprint(content)
    except:
        usage(prefix)
github xlcnd / isbntools / isbntools / bin / from_words.py View on Github external
def main(args=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    try:
        args = sys.argv if not args else args
    except:
        return usage(prefix)
    if len(args) < 2:
        return usage(prefix)

    try:
        if PY2:
            words = args[1].decode(sys.stdin.encoding)
            words = words.encode('UTF-8')
        else:
            # FIXME see: isbnlib.dev.webservice
            words = args[1]
        print(isbn_from_words(words))
        return 0
github xlcnd / isbntools / isbntools / bin / to_isbn13.py View on Github external
def main(isbn=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    try:
        isbn = sys.argv[1] if not isbn else isbn[1]
        isbn13 = to_isbn13(isbn)
        if isbn13:
            print(isbn13)
    except:
        return usage(prefix)
github xlcnd / isbntools / isbntools / bin / mask.py View on Github external
def main(isbn=None, prefix=PREFIX):
    sys.excepthook = quiet_errors
    try:
        isbn = sys.argv[1] if not isbn else isbn[1]
        output = mask(isbn)
        if output:
            print(output)
    except:
        usage(prefix)