Skip to main content

A Python client for Antivirus Microservice

Project description

antivirus-microservice

Antivirus Microservice Python Client

This is a Python client for the free and fully functional Antivirus Microservice Server. It allows you to easily integrate virus scanning capabilities into your Python applications.

Table of Contents

Installation

You can install this package via pip:

pip install antivirus-microservice

Usage

Here's a basic example of how to use the Antivirus Microservice client:

from antivirus_microservice import AntivirusMicroservice

antivirus = AntivirusMicroservice('http://localhost:3000')
result = antivirus.check_file('/path/to/your/file.txt')

if result['ok']:
    print("File is clean")
else:
    print(f"File is infected: {result['viruses']}")

API

The AntivirusMicroservice class provides the following method:

  • check_file(file_path): Scans the provided file for viruses. Returns a dictionary with:
    • ok: boolean indicating whether the file is clean (True) or infected (False)
    • viruses: a list of detected virus names (only present if ok is False)

Configuration

When initializing the AntivirusMicroservice class, you can specify the URL of your Antivirus Microservice server. By default, it uses http://localhost:3000.

antivirus = AntivirusMicroservice('http://your-custom-url:port')

Error Handling

The client handles basic errors:

  • If there's an error communicating with the server, it returns {'ok': False, 'viruses': ['Error checking file']}.
  • The specific error message is printed to the console.

Requirements

  • Python 3.6 or higher
  • requests library

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open-sourced software licensed under the MIT license.

Support

If you encounter any problems or have questions, please open an issue in the project repository.

Created by

Dimitry Ivanov 2@ivanoff.org.ua # curl -A cv ivanoff.org.ua

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

antivirus-microservice-0.1.1.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

antivirus_microservice-0.1.1-py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page