{"id":5332,"library":"multiurl","title":"multiurl","description":"multiurl is a Python package designed to simplify downloading multiple URLs, including support for multi-part URLs. It allows downloading several files into one or specific byte ranges from a single URL. Maintained by ECMWF, it has seen regular updates, with version 0.3.7 released in July 2025, indicating an active development cadence despite its listed 'Alpha' status on PyPI.","status":"active","version":"0.3.7","language":"en","source_language":"en","source_url":"https://github.com/ecmwf/multiurl","tags":["url","download","multi-part","http","ftp","web","ecmwf"],"install":[{"cmd":"pip install multiurl","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"download","correct":"from multiurl import download"}],"quickstart":{"code":"from multiurl import download\nimport os\n\n# NOTE: For this quickstart, actual network requests are simulated for illustrative\n# purposes to ensure it is runnable without external dependencies or network issues.\n# In a real application, 'download' performs actual HTTP/FTP requests.\n\ndef simulated_download(url, target=None, parts=None, **kwargs):\n    print(f\"\\n--- Simulating download operation ---\")\n    print(f\"  URLs(s): {url}\")\n    print(f\"  Target file: {target}\")\n    if parts:\n        print(f\"  Requested parts: {parts}\")\n    print(f\"  Additional parameters: {kwargs}\")\n    if target:\n        try:\n            with open(target, 'w') as f:\n                f.write(f\"Simulated content for {target} from {url}\\n\")\n            print(f\"  Created simulated file: {target}\")\n        except IOError as e:\n            print(f\"  Error creating simulated file {target}: {e}\")\n    print(\"--- Simulation complete ---\")\n\n# Monkey-patch the actual download function for simulation in quickstart\n# In a real application, you would just call `multiurl.download`\nmultiurl.download = simulated_download\n\n# Example 1: Download a single URL into a specified target file\nmultiurl.download(url=\"http://example.com/data.txt\", target=\"example_data.txt\")\n\n# Example 2: Download content from multiple URLs and combine into one file\nmultiurl.download(\n    url=[\"http://example.com/part1.json\", \"http://example.com/part2.json\"],\n    target=\"combined_parts.json\"\n)\n\n# Example 3: Download specific byte ranges (parts) from a single URL\n# This requires the server to support HTTP Range requests.\nmultiurl.download(\n    url=\"http://example.com/large_file.bin\",\n    parts=[(0, 1024), (2048, 512)],\n    target=\"file_segments.bin\"\n)\n\n# Clean up simulated files (optional, for actual cleanup uncomment below)\n# os.remove(\"example_data.txt\")\n# os.remove(\"combined_parts.json\")\n# os.remove(\"file_segments.bin\")\n\nprint(\"\\nQuickstart demonstration complete. Check your directory for simulated files.\")","lang":"python","description":"This quickstart demonstrates the `multiurl.download` function. It supports downloading single URLs, combining multiple URLs into one target file, and fetching specific byte-range 'parts' from a single URL. The provided code simulates network operations to ensure it is runnable without external network dependencies for demonstration purposes."},"warnings":[{"fix":"Upgrade to `multiurl` version 0.3.2 or newer to ensure compatibility with Python 3.13 and future Python versions.","message":"The `cgi` module was removed from Python 3.13. `multiurl` versions prior to 0.3.2 may experience `ModuleNotFoundError` or other issues when running on Python 3.13+ if they relied on internal `cgi` usage.","severity":"breaking","affected_versions":"<0.3.2"},{"fix":"Upgrade to `multiurl` 0.3.7 or newer, which includes a retry mechanism to handle `ChunkedEncodingError`.","message":"Versions prior to 0.3.7 might fail with `ChunkedEncodingError` during downloads, particularly when dealing with certain HTTP responses that use chunked transfer encoding.","severity":"gotcha","affected_versions":"<0.3.7"},{"fix":"Upgrade to `multiurl` version 0.3.3 or newer to benefit from fixes in `content-disposition` header handling.","message":"Older versions of `multiurl` (prior to 0.3.3) may incorrectly handle filenames derived from the `Content-Disposition` HTTP header, potentially leading to corrupted or misnamed downloaded files.","severity":"gotcha","affected_versions":"<0.3.3"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}