{ "info": { "author": "DashLt", "author_email": "", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: AsyncIO", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP" ], "description": "# multithread\n\nMultithread is an optionally asynchronous Python library for downloading files using several threads.\n\n# Features\n\n* Lightweight: one file, a little over 100 lines of code excluding license\n* Extensive: the ability to pass your own sessions and your own arguments to each request means you don't need to wait for your desired feature to be implemented; anything you can do in aiohttp, you can do in multithread!\n* Fast: benefit from the speed of aiohttp and multithreaded downloading!\n\n# Installation\n\nRequirements:\n\n* Python 3.5.3+\n* aiohttp\n* Tinche/aiofiles\n* optional: tqdm\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install multithread. \nFor support for progress bars, install multithread[progress].\n\n```bash\npip3 install multithread\n```\n\n# Usage\n\n```python\nimport multithread\n\ndownload_object = multithread.Download(\"http://url.com/file\", filename)\ndownload_object.start()\n\n# passing headers (you can pass any other arguments that aiohttp.ClientSession.request can take as well)\ndownload_object = multithread.Download(\"http://url.com/file\", filename, aiohttp_args={\"headers\": {\"a\": \"b\", \"c\": \"d\"}})\ndownload_object.start()\n```\n\n# Documentation\n\n# Downloader\n```python\nDownloader(self, url, file, threads=4, session=None, progress_bar=True, aiohttp_args={'method': 'GET'}, create_dir=True)\n```\n\nAn optionally asynchronous multi-threaded downloader class using aiohttp\n\nAttributes:\n\n - url (str): The URL to download\n - file (str or path-like object): The filename to write the download to.\n - threads (int): The number of threads to use to download\n - session (aiohttp.ClientSession): An existing session to use with aiohttp\n - new_session (bool): True if a session was not passed, and the downloader created a new one\n - progress_bar (bool): Whether to output a progress bar or not\n - aiohttp_args (dict): Arguments to be passed in each aiohttp request. If you supply a Range header using this, it will be overwritten in fetch()\n\n## \\_\\_init\\_\\_\n```python\nDownloader.__init__(self, url, file, threads=4, session=None, progress_bar=True, aiohttp_args={'method': 'GET'}, create_dir=True)\n```\nAssigns arguments to self for when asyncstart() or start() calls download.\n\nAll arguments are assigned directly to self except for:\n\n - session: if not passed, a ClientSession is created\n - aiohttp_args: if the key \"method\" does not exist, it is set to \"GET\"\n - create_dir: see parameter description\n\nParameters:\n\n - url (str): The URL to download\n - file (str or path-like object): The filename to write the download to.\n - threads (int): The number of threads to use to download\n - session (aiohttp.ClientSession): An existing session to use with aiohttp\n - progress_bar (bool): Whether to output a progress bar or not\n - aiohttp_args (dict): Arguments to be passed in each aiohttp request. If you supply a Range header using this, it will be overwritten in fetch()\n - create_dir (bool): If true, the directories encompassing the file will be created if they do not exist already.\n\n## start\n```python\nDownloader.start(self)\n```\nCalls asyncstart() synchronously\n## asyncstart\n```python\nDownloader.asyncstart(self)\n```\nRe-initializes file and calls download() with it. Closes session if necessary\n## fetch\n```python\nDownloader.fetch(self, progress=False, filerange=(0, ''))\n```\nIndividual thread for fetching files.\n\nParameters:\n\n - progress (bool or tqdm.Progress): the progress bar (or lack thereof) to update\n - filerange (tuple): the range of the file to get\n\n## download\n```python\nDownloader.download(self)\n```\nGenerates ranges and calls fetch() with them.\n\n\n# Contributing\nAny and all pull requests are welcome. As this is a small project, there are no strict standards, but please try to keep your code clean to a reasonable standard. Alternatively, if you would like to clean *my* code, that would be more than welcome!\n\n# License\n[MIT](https://choosealicense.com/licenses/mit/)\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/DashLt/multithread", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "multithread", "package_url": "https://pypi.org/project/multithread/", "platform": "", "project_url": "https://pypi.org/project/multithread/", "project_urls": { "Homepage": "https://github.com/DashLt/multithread" }, "release_url": "https://pypi.org/project/multithread/1.0.1/", "requires_dist": [ "aiohttp", "aiofiles", "tqdm ; extra == 'progress'" ], "requires_python": ">3.5", "summary": "An optionally asynchronous multithreaded downloader for python", "version": "1.0.1" }, "last_serial": 5765013, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "59684068d6c68b3dada0a30f5c527967", "sha256": "5c28803a6329abad283981101d473b697f95dd53a6a294175ef018ffd7354f81" }, "downloads": -1, "filename": "multithread-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "59684068d6c68b3dada0a30f5c527967", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.5", "size": 5150, "upload_time": "2019-08-31T15:07:16", "url": "https://files.pythonhosted.org/packages/57/d3/871fa7d078a956a1d0bed4e74e883ada7147d3fd4c5ef0415c8b9028efa4/multithread-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "fd7e03669717819aebb7db4407484ecc", "sha256": "f2e01683cc36ff80fd64f23c0b26e3b409d3448957e99bbaba83bb4268f792da" }, "downloads": -1, "filename": "multithread-1.0.tar.gz", "has_sig": false, "md5_digest": "fd7e03669717819aebb7db4407484ecc", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.5", "size": 3812, "upload_time": "2019-08-31T15:07:18", "url": "https://files.pythonhosted.org/packages/17/27/2c26c902848872cd08fcaf655355293d7360d48f80d2bb4d5a1212c5aa1a/multithread-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "c54b3c1cccaecb2c451e55bb63a0306c", "sha256": "e9880543e885f77f1e34c2019742f639aaebee87c74d893dc20c0eb9098fbd0d" }, "downloads": -1, "filename": "multithread-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c54b3c1cccaecb2c451e55bb63a0306c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.5", "size": 5258, "upload_time": "2019-08-31T18:42:15", "url": "https://files.pythonhosted.org/packages/45/52/64dc375bff64c23fe505bf6ab59a299883bdebfba888fb4f1a4cf1d6c090/multithread-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5d067f9155036570e3df86884abdc06", "sha256": "4b21503d93a633b70ab75ec7c7d7afa3ecb1d1c5d36b2ae75be18e4b03026754" }, "downloads": -1, "filename": "multithread-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e5d067f9155036570e3df86884abdc06", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.5", "size": 3848, "upload_time": "2019-08-31T18:42:17", "url": "https://files.pythonhosted.org/packages/19/b0/812b3b410c2703ce0c42cb8c28f79b1c43ea21ba0e4a26985845920f7a04/multithread-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c54b3c1cccaecb2c451e55bb63a0306c", "sha256": "e9880543e885f77f1e34c2019742f639aaebee87c74d893dc20c0eb9098fbd0d" }, "downloads": -1, "filename": "multithread-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "c54b3c1cccaecb2c451e55bb63a0306c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">3.5", "size": 5258, "upload_time": "2019-08-31T18:42:15", "url": "https://files.pythonhosted.org/packages/45/52/64dc375bff64c23fe505bf6ab59a299883bdebfba888fb4f1a4cf1d6c090/multithread-1.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e5d067f9155036570e3df86884abdc06", "sha256": "4b21503d93a633b70ab75ec7c7d7afa3ecb1d1c5d36b2ae75be18e4b03026754" }, "downloads": -1, "filename": "multithread-1.0.1.tar.gz", "has_sig": false, "md5_digest": "e5d067f9155036570e3df86884abdc06", "packagetype": "sdist", "python_version": "source", "requires_python": ">3.5", "size": 3848, "upload_time": "2019-08-31T18:42:17", "url": "https://files.pythonhosted.org/packages/19/b0/812b3b410c2703ce0c42cb8c28f79b1c43ea21ba0e4a26985845920f7a04/multithread-1.0.1.tar.gz" } ] }