A lightweight management system for applying and releasing exclusive resources.
Project description
# Reskeeper
[](https://github.com/qige96/reskeeper)
[](https://reskeeper.readthedocs.io/en/latest/)
A lightweight management system for applying and releasing exclusive resources.
## Introduction
Considering these scenarios: you are doing web crapping that
requiring proxies with multi-threads, and each thread can only
use one proxy and one proxy can only be used by one thread at
one time; or you are doing monkey tests for login process of
your several applications at one time, each application can
only use one test account and each account can only be used
by one application at one time. You will need to manage the
applying and releasing of these **exclusive resources**, and
here is this little system taht can help.
## Installation
You can install it by just one command
```shell
pip install reskeeper
```
or
```shell
git install git+https://github.com/qige96/reskeeper.git
```
## Quick Start
```python
from reskeeper import ResourceKeeper
resources = [
"resource1",
"resource2",
]
rk = ResourceKeeper() # create a resource keeper instance
rk.load(resources) # load a batch of data
res1 = rk.get() # get a resource
res2 = rk.get() # get one more resource
res3 = rk.get() # None, no resource available
print(res1) # <res_id: 1>
print(res2.res_id,
res2.data) # (2, "resource2")
print(res3) # None
rk.release(res1) # release a resource
res4 = rk.get() # one resource available
print(res4.to_dict()) # {'res_id': 1, 'data': 'resource1'}
```
## Documentation
see https://reskeeper.readthedocs.io
[](https://github.com/qige96/reskeeper)
[](https://reskeeper.readthedocs.io/en/latest/)
A lightweight management system for applying and releasing exclusive resources.
## Introduction
Considering these scenarios: you are doing web crapping that
requiring proxies with multi-threads, and each thread can only
use one proxy and one proxy can only be used by one thread at
one time; or you are doing monkey tests for login process of
your several applications at one time, each application can
only use one test account and each account can only be used
by one application at one time. You will need to manage the
applying and releasing of these **exclusive resources**, and
here is this little system taht can help.
## Installation
You can install it by just one command
```shell
pip install reskeeper
```
or
```shell
git install git+https://github.com/qige96/reskeeper.git
```
## Quick Start
```python
from reskeeper import ResourceKeeper
resources = [
"resource1",
"resource2",
]
rk = ResourceKeeper() # create a resource keeper instance
rk.load(resources) # load a batch of data
res1 = rk.get() # get a resource
res2 = rk.get() # get one more resource
res3 = rk.get() # None, no resource available
print(res1) # <res_id: 1>
print(res2.res_id,
res2.data) # (2, "resource2")
print(res3) # None
rk.release(res1) # release a resource
res4 = rk.get() # one resource available
print(res4.to_dict()) # {'res_id': 1, 'data': 'resource1'}
```
## Documentation
see https://reskeeper.readthedocs.io
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
reskeeper-0.1.1.tar.gz
(1.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file reskeeper-0.1.1.tar.gz.
File metadata
- Download URL: reskeeper-0.1.1.tar.gz
- Upload date:
- Size: 1.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6079244fc1b10e59e492a9be4cb521d3b32e61d0b6436095b97fea80471e22c8
|
|
| MD5 |
f3a100d1cc088e59a76b24d7bbb2e857
|
|
| BLAKE2b-256 |
e372aa17a95ffa0698388a41db2e9a08bb39a4070cf244818f2f61d7f9342432
|
File details
Details for the file reskeeper-0.1.1-py3-none-any.whl.
File metadata
- Download URL: reskeeper-0.1.1-py3-none-any.whl
- Upload date:
- Size: 1.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6484c903d71870279d27f7c1fde9889b69881c8f41a656268682ab410b548d80
|
|
| MD5 |
b0d4974ed169ba246a76a710ee6e8c01
|
|
| BLAKE2b-256 |
f97920ef8b316a7824fc5862fcadcedf510d420517df708d8af3901f2f9f9a09
|