Skip to main content

Concurrent libraries for easy use of thread pools, process pools, and coroutines

Project description

pip install concurrent-tool

Concurrent libraries for easy use of thread pools, process pools, and coroutines

requests must be installed to test before use,but the concurrent-tool library is not dependent

import requests
from tool import Multithreading, Multiprocess, Coroutines

def get_info(url):
    data = requests.get(url)
    print(data.status_code)
    return data

# use multithreading

request_list = [
                "http://icanhazip.com",
                "https://github.com/OmkarPathak/pygorithm",
                "https://www.cnblogs.com/lipijin/p/3862684.html"
               ]
multithreading = Multithreading(get_info, request_list, 2)
multithreading.multithreading()

# use multiprocess
multiprocess = Multiprocess(get_info, request_list, 3)
multiprocess.multiprocess()


# use coroutines
Coroutines([get_info(url) for url in request_list])

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

concurrent_tool-0.0.1-py3-none-any.whl (2.5 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