Skip to main content

SauceNAO

tests Coverage Status GitHub Scrutinizer Code Quality
unofficial python module to make working with SauceNAO in projects easier

Installation

This package requires Python 3.6 or later.

You can simply install the latest version with

pip install SauceNAO

Alternatively you can download this repository and run the setup.py to install all necessary dependencies. In case you want to install the dependencies to run the unit tests you can additionally run pip install -e .[dev] in this project.

Dependencies

Required:

Optional:

  • Pillow - Python Imaging Library, used to generate images for unittests
  • python-dotenv - .env file loader used for unittests
  • requests-mock - requests mock responses used for unittests

Usage

You can run SauceNAO either as module:

import logging

from saucenao import SauceNao, SauceNaoDatabase

saucenao = SauceNao(directory='directory', databases=SauceNaoDatabase.All, minimum_similarity=65,
                    combine_api_types=False, api_key='', is_premium=False, exclude_categories='',
                    move_to_categories=False, use_author_as_category=False, output_type=SauceNao.API_HTML_TYPE,
                    start_file='', log_level=logging.ERROR, title_minimum_similarity=90)

or as application:

python usage.py --dir [--databases] [--minimum-similarity] [--combine-api-types] [--api-key] [--premium]
                [--exclude-categories] [--move-to-categories] [--use-author-as-category] [--output-type] [--start-file]
                [--log-level] [--filter-creation-date] [--filter-modified-date] [--title-minimum-similarity]

you can also use it to get the gathered information for your own script:

filtered_results = saucenao.check_file(file_name='test.jpg')
# or with streams/byte objects
filtered_results = saucenao.check_file(io.BytesIO(b'\x00'))

or get a generator object for a bulk of files using the worker class, all parameters work here too:

from saucenao import Worker

results = Worker(directory='directory', files=('test.jpg', 'test2.jpg', io.BytesIO(b'\x00'))).run()

the worker automatically differentiates between file names and BinaryIO objects, so you can simply pass both types at the same time.

Running the tests

In the tests folder you can run each unittest individually.
The test cases should be self-explanatory.

Development

Want to contribute? Great!
I'm always glad hearing about bugs or pull requests.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Thanks

A big thanks to SauceNAO who are indexing all the images and compares them.
This script would be completely useless without them.

Metadata

Release files for SauceNAO 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SauceNAO 1.1.0
File Size Uploaded
SauceNAO-1.1.0.tar.gz 16.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SauceNAO 1.1.0
File Interpreter ABI Platform
SauceNAO-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.8 kB

Release files / SauceNAO-1.1.0.tar.gz

Download URL SauceNAO-1.1.0.tar.gz
Size 16.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cd58bd251f80b42703c8c8dba14cfcfd513dadf25cdfe3a03d86e77edda686c9
BLAKE2b-256 checksum
How to use checksums
d25e5fdb966f057a5686344dff160c09d450da27df6d8c523eafcfdb7276057e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

Release files / SauceNAO-1.1.0-py3-none-any.whl

Download URL SauceNAO-1.1.0-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04e116b217357cbd3c16af1eae0853a3f2fdba3bf1f5a118040fec4baa4b3825
BLAKE2b-256 checksum
How to use checksums
798d3a1a6b5c299d1a4b81c7f28e18673f2be099641f4d4f42f2d4ab554d3c5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page