{"id":22300734,"url":"https://github.com/jacksonwuxs/easythreading","last_synced_at":"2025-08-31T20:32:55.941Z","repository":{"id":57425290,"uuid":"221853101","full_name":"JacksonWuxs/easyThreading","owner":"JacksonWuxs","description":"A user-friendly threading management library for humans","archived":false,"fork":false,"pushed_at":"2019-11-15T05:50:58.000Z","size":4,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T11:05:44.127Z","etag":null,"topics":["python","python-library","scrapy-crawler","threading"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JacksonWuxs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-15T05:47:50.000Z","updated_at":"2024-07-11T17:33:00.000Z","dependencies_parsed_at":"2022-08-29T22:51:09.612Z","dependency_job_id":null,"html_url":"https://github.com/JacksonWuxs/easyThreading","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JacksonWuxs/easyThreading","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacksonWuxs%2FeasyThreading","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacksonWuxs%2FeasyThreading/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacksonWuxs%2FeasyThreading/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacksonWuxs%2FeasyThreading/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JacksonWuxs","download_url":"https://codeload.github.com/JacksonWuxs/easyThreading/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacksonWuxs%2FeasyThreading/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262762460,"owners_count":23360329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","python-library","scrapy-crawler","threading"],"created_at":"2024-12-03T18:13:47.465Z","updated_at":"2025-06-30T11:05:45.341Z","avatar_url":"https://github.com/JacksonWuxs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# easyThreading\n![](https://img.shields.io/badge/Python2-pass-green.svg)![](https://img.shields.io/badge/Python3-pass-green.svg)![](https://img.shields.io/badge/Download-PyPi-green.svg)![](https://img.shields.io/badge/License-GNU-blue.svg)\n\n#### What is easyThreading?\n\nThis program offers you a threading pool with beautiful APIs.\n\n#### How does it work?\n\nInside easyThreading, we manage all your worker threading by keeping a daemon thread.\n\n#### Usages\n\n* You are going to collect the NBA game information as follow:\n\n```python\nimport requests\nimport json\n\nurl = \"http://matchweb.sports.qq.com/kbs/list?from=NBA_PC\u0026columnId=100000\u0026startTime={}\u0026endTime={}\u0026callback=ajaxExec\u0026_=1540442149442\"     \nheader = {\"User-Agent\": \"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36\"}\n\ndef getDate(begin_year):\n    for year in range(begin_year, 2020):\n        for month in range(1, 12):\n            month = str(month).rjust(2, '0')\n            for day in range(1, 32):\n                day = str(day).rjust(2, '0')\n                yield ('%s-%s-%s'  % (year, month, day), )\n\ndef getMatch(url, header, date):\n    web_data = requests.get(url.format(date, date), headers=header)\n    web_data.encoding = 'utf-8'\n    data = json.loads(web_data.text[9:-1])['data']\n    if date in data:\n        return [match for match in data[date]]\n```\n\n* Launch your workers\n\n```python\nfrom easyThreadPool import Pool\n\n# since `url` and `header` are the same all the time, \n# we settle down them when we initial the Pool\nwith Pool(max_size=100, target=getMatch, args=(url, header)) as pool:\n\t\n\t# different parameters are created by function getDate\n\titer_parameters = getDate(begin_year=2015)\n\t\n\t# create workers for your task when there are not full in the pool\n\tpool.map(iter_parameters)\n\t\n\t# block the main thread until all workers are done\n\tpool.join()\n\t\n\t# get match information from all workers\n\t# THIS IS A THREAD SAFETY OPERATION !!!\n\tresults = pool.get_results() # return results as a list\n\t\n\t# read the report \n\tpool.report()\n    \n''' output\n - Threading Pool for task getMatch\n   * current Pool is Active: True\n   * totally lunched 341 threads\n   * current working 0 threads\n   * average working time 0.25 seconds\n   * average waiting time 0.00 seconds\n '''\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacksonwuxs%2Feasythreading","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacksonwuxs%2Feasythreading","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacksonwuxs%2Feasythreading/lists"}