Skip to main content

Official client for openblacklist API

Project description

pip install openblacklist

OpenBlacklist

Official client for the OpenBlacklist API.

Description

OpenBlacklist is a Python client library for interacting with the OpenBlacklist API. It allows you to check if a user is blacklisted, handle webhooks, and trigger specific events based on webhook data.

Installation

You can install the library using Poetry:

poetry add openblacklist

Or

pip install openblacklist
```

## Usage

```py
from openblacklist import OpenBlacklistClient

api_key = "your_api_key"
client = OpenBlacklistClient(api_key)
```

### Check if user is blacklisted

```py
import asyncio

async def check_user():
    user_id = 12345
    user_blacklist = await client.check_user(user_id)
    print(user_blacklist)

asyncio.run(check_user())
```

### Handling Webhooks
To handle webhooks, you need to set up an endpoint and define event handlers.

```py
@client.event("add")
async def handle_add_event(event):
    print(f"User added: {event.user}")

@client.event("remove")
async def handle_remove_event(event):
    print(f"User removed: {event.user}")

client.listen()
```

### Running the server

```py
client.listen(host="0.0.0.0", port=5000)
```

### Configuration
```py
client = OpenBlacklistClient(api_key, url="https://openbl.clarty.org/api/v1/", webhook_url="your_webhook_url")
```

## License

This project is licensed under the MIT License.

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

openblacklist-1.1.1.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openblacklist-1.1.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file openblacklist-1.1.1.tar.gz.

File metadata

  • Download URL: openblacklist-1.1.1.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for openblacklist-1.1.1.tar.gz
Algorithm Hash digest
SHA256 2875502ccf6b3118430bb9d74a547b0b1a20f5bc7aa4cc1a6d0fa7c2a6a8697d
MD5 b7f7b1257c780f2eeaf97cfcb27d3f49
BLAKE2b-256 bde9bb0e908e8a88ffbcae404a2856f57e730999b8c02da77fa7fbf45bc1795a

See more details on using hashes here.

Provenance

The following attestation bundles were made for openblacklist-1.1.1.tar.gz:

Publisher: publish.yml on Awakno/OpenBlacklist-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openblacklist-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: openblacklist-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for openblacklist-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9785ae5ccfa38f8f71f639570a6574a984323e53887abd570645680c05fd95b
MD5 280405ff294b2c417edb1909c9b213c0
BLAKE2b-256 e28d06def85e657b8ba63c4f32c8df447d5cb4076ccc7937194db18efc03b911

See more details on using hashes here.

Provenance

The following attestation bundles were made for openblacklist-1.1.1-py3-none-any.whl:

Publisher: publish.yml on Awakno/OpenBlacklist-py

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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