Coder Social home page Coder Social logo

getfiles's Introduction

GetFiles

Description

GetFiles is a small python program that saves the contents of a URL to a file or resumes the download if previously incomplete. It uses the Requests HTTP library.

GetFiles works by making a request to the URL and saving its contents to a file. The not so secret sauce lies in checking up the file size in bytes in a HEAD request, to later compare it to the current file size on disk (if existent). If file already exists on path, a Range header is sent along the request and the reponse object's content returned is streamed according to the Range header values.

##Requirements

##Usage

Download the GetFiles.py file to any directory on your computer. On the command line terminal, navigate to the downloaded file location and run the script according to following arguments:

python GetFiles.py url --v

If the URL doesn't end with a file name, the program will default the file name to "file-dummy".

###Arguments:

url: The url you want to download. Must inlcude http://.

--v: Verbose. Prints the headers of the response, how many bytes are left for download and total bytes transfered when finished.

###Example

python GetFiles.py http://google.com --v

##To-do

  • HTTP Error handling.
  • Catch keyboard interrumption.
  • Use hash for file content check.
  • Verbose adittions: Download bar, percentage complete update, size complete.
  • File dummy auto incremental value.
  • Detect content type and react accodingly.

Sources

getfiles's People

Contributors

elabx avatar

Watchers

 avatar

Forkers

flyinggh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.