https://github.com/null-none/threadpools
This is a simple thread pool for python (using queue module).
https://github.com/null-none/threadpools
python python3 queue thread
Last synced: 7 months ago
JSON representation
This is a simple thread pool for python (using queue module).
- Host: GitHub
- URL: https://github.com/null-none/threadpools
- Owner: null-none
- License: mit
- Created: 2022-01-20T17:54:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-31T09:05:36.000Z (almost 4 years ago)
- Last Synced: 2025-09-22T22:52:55.755Z (7 months ago)
- Topics: python, python3, queue, thread
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# threadpools
This is a simple thread pool for python (using queue module).
#### Install
```bash
pip install threadpools
```
#### Example
```python
from threadpools import ThreadPools
import requests
urls = ["https://jsonplaceholder.typicode.com/todos/{}".format(i) for i in range(30)]
pool = ThreadPools(30)
r = requests.session()
def get(url):
resp = r.get(url)
return resp.json()
pool.map(get, urls)
pool.destroy()
pool = ThreadPools(30)
r = requests.session()
def get():
resp = r.get("https://jsonplaceholder.typicode.com/todos/1")
return resp.json()
pool.add_task(get)
pool.destroy()
```