Skip to main content

MarsCore (Mars Core) - Developed by Chinese developer Mars (formerly: Ma Yu Chao),A high-performance, robust download manager built with Python that supports both multi-process,and multi-thread downloading with intelligent error handling and resume capabilities.

Project description

Multi-Process Multi-Thread Downloader A high-performance, robust download manager built with Python that supports both multi-process and multi-thread downloading with intelligent error handling and resume capabilities. MarsCore (Mars Core) - Developed by Chinese developer Mars (formerly: Ma Yu Chao),A high-performance, robust download manager built with Python that supports both multi-process,and multi-thread downloading with intelligent error handling and resume capabilities.

🚀 Features Multi-Process Architecture: Download multiple files simultaneously using separate processes

Multi-Thread Downloading: Split large files into chunks and download concurrently

Intelligent Error Handling: Smart retry mechanism for different types of errors

Resume Support: Continue interrupted downloads from where they left off

Progress Monitoring: Real-time progress tracking with speed and ETA

Memory Management: Configurable buffer sizes to prevent memory overflow

Configurable Retry Logic: Customizable retry counts for different error types

📋 Requirements bash pip install marscore

import marscore

urls = [ "https://example.com/file1.zip", "https://example.com/file2.zip", "https://example.com/file3.zip" ]

results = marscore.downloader( urls=download_urls, process=4, # Use 4 processes for 4 URLs threads=10 )

print(f"All downloads completed. Results: {sum(results)} successful out of {len(results)}")

⚙️ Configuration Parameters Download Parameters url: Target URL to download

output_dir: Output directory (default: 'output')

output_filename: Custom filename for the downloaded file

threads: Number of threads per download (default: 2)

process: Number of processes for multiple downloads (default: min(url_count, 4))

Performance Parameters buffer_size_mb: Memory buffer size in MB (default: 10)

chunk_size: Download chunk size in bytes (default: 8192)

retry_num: Maximum retry attempts (default: 3)

Network Parameters headers: Custom HTTP headers

timeout: Request timeout in seconds (default: 30)

proxies: Proxy configuration

verify: SSL verification (default: False)

🔧 Advanced Configuration Custom Headers python custom_headers = { 'User-Agent': 'Custom User Agent', 'Authorization': 'Bearer token' }

marscore.downloader( url="https://example.com/file.zip", headers=custom_headers, threads=8 )

With Proxy python proxies = { 'http': 'http://proxy.example.com:8080', 'https': 'https://proxy.example.com:8080' }

marscore.downloader( url="https://example.com/file.zip", proxies=proxies, threads=4 )

🎯 Error Handling Retryable Errors (will retry based on retry_num) HTTP Status Codes: 500, 502, 503, 504, 429

Network Errors: Connection timeouts, DNS resolution failures, network interruptions

Temporary Issues: Server overload, rate limiting

Non-Retryable Errors (immediate failure) HTTP Status Codes: 404, 403, 410

Client Errors: File not found, access denied, authentication issues

Custom Retry Configuration python

Retry up to 10 times for server errors

marscore.downloader( urls=urls, retry_num=10, threads=4 )

📊 Progress Monitoring The downloader provides real-time progress information including:

Download percentage

Download speed (B/s, KB/s, MB/s)

Estimated time remaining (ETA)

Active vs completed threads

Retry attempts and status

💾 Memory Management To prevent memory overflow during large concurrent downloads:

Automatic buffer flushing: Data is written to disk when buffer reaches configured size

Configurable memory limits: Set maximum memory usage with buffer_size_mb

Efficient chunking: Downloads are split into manageable chunks

python

Conservative memory usage

marscore.downloader( url="https://example.com/very-large-file.iso", buffer_size_mb=5, # 5MB buffer chunk_size=4096, # 4KB chunks threads=4 )

🏗️ Architecture Multi-Process Level Each URL is processed in a separate process

Independent progress monitoring for each download

Process pool for efficient resource utilization

Multi-Thread Level Each file is split into multiple chunks

Concurrent downloading of chunks using threads

Thread-safe progress tracking and file writing

Progress Communication Manager Queue for inter-process communication

Real-time progress updates to monitor process

Thread-safe locking mechanisms

🔄 Resume Capability The downloader automatically:

Saves progress at regular intervals

Resumes from the last saved position after interruptions

Validates downloaded chunks for integrity

Cleans up temporary files after successful completion

🚨 Error Recovery The downloader handles various failure scenarios:

Network Interruptions: Automatically resumes when connection is restored

Server Errors: Retries with exponential backoff

Disk Space Issues: Clean error reporting and graceful shutdown

Permission Problems: Clear error messages for file access issues

📈 Performance Tips Optimal Thread Count: 4-8 threads per download usually provides best performance

Memory Configuration: Adjust buffer size based on available RAM

Network Settings: Increase timeout for slow connections

Process Count: Match process count to CPU cores for optimal performance

👨‍💻 Author marscore (原名: Ma Yu Chao)

Email: marscore@163.com

GitHub: https://github.com/mars-core/

📄 License This project is open source and available under the MIT License.

🤝 Contributing Contributions, issues, and feature requests are welcome! Feel free to check the issues page.

⚠️ Disclaimer Use this downloader responsibly and in compliance with:

Website terms of service

Copyright laws

Rate limiting policies

Server resource constraints

Project details


Download files

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

Source Distribution

marscore-0.1.9.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

marscore-0.1.9-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file marscore-0.1.9.tar.gz.

File metadata

  • Download URL: marscore-0.1.9.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for marscore-0.1.9.tar.gz
Algorithm Hash digest
SHA256 e608f566e49697e89c62ccc9c054db2e9994bec35e01ea2c78f4f8de55c6477f
MD5 85696603ece0cff1771e7fcec47d0c7e
BLAKE2b-256 cef55dc26b2e66d992713c77ccdb73cdf9a5d651c38abe64d7b9b03b33189bb6

See more details on using hashes here.

File details

Details for the file marscore-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: marscore-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for marscore-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 210f1a296d4fc8fb290480b4a8e6df194ee2f7ddc6baec31a394cbfb80e4cced
MD5 60d0e0353ef902f2a3d9e6f69fc2c53a
BLAKE2b-256 89bbaffd3b3b7769a65c5398124c5e9634e138c044072088387044c032625c97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page