BPOLICY
A collection of basic policies for resources anti-spammer.
Install from Pypi
pip install bpolicy
Basic Example
import memcache
from bpolicy.consts import MINUTE, HOUR
from bpolicy import RatedPolicyFactory, ClockPolicyFactory, GenerationedPolicyFactory
from bpolicy import chained_policy, silent_check
store = memcache.Client(['127.0.0.1:9013'])
rated_factory = RatedPolicyFactory(quota=10, interval=1 * MINUTE)
clock_factory = ClockPolicyFactory(start_time=time(hour=1), end_time=time(hour=6), discount=0.3)
generationed_factory = GenerationedPolicyFactory(quota=10, interval=1 * HOUR, discount=0.5, max_keep_traking=3)
def check_policy(identity):
return silent_check(chained_policy('hello', [generationed_factory, clock_factory, rated_factory], store), identity)
identity = "88.88.23.1"
for i in range(100):
if check_policy(identity):
print("success")
else:
print("banded")
Metadata
Release files for bpolicy 0.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bpolicy-0.3.3.tar.gz | 5.5 kB | Without provenance | Details |
Release files / bpolicy-0.3.3.tar.gz
| Download URL | bpolicy-0.3.3.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12948b12d8b23bd47b2f86165a9e52d9f39a003d8f82829cb49fc542a9328ea8
|
|
BLAKE2b-256 checksum How to use checksums |
96c788006a687fca8ac1657ccf1a6d9ea97712afadb9bd2f748e660de68b5c4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for bpolicy 0.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.