download


Namedownload JSON
Version 0.3.5 PyPI version JSON
download
home_pagehttps://github.com/choldgraf/download
SummaryA quick module to help downloading files using python.
upload_time2020-04-23 22:02:46
maintainerChris Holdgraf
docs_urlNone
author
requires_python
licenseBSD (3-clause)
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            .. image:: https://codecov.io/gh/choldgraf/download/branch/master/graph/badge.svg
  :target: https://codecov.io/gh/choldgraf/download
  :align: left

.. image:: https://circleci.com/gh/choldgraf/download.svg?style=svg
    :target: https://circleci.com/gh/choldgraf/download
    :align: left

Download
--------
A no-frills tool to download files from the web. It will
attempt to be smart about not downloading data that's
already there, checking to make sure that
there were no errors in fetching data, automatically unzipping the contents
of downloaded zipfiles (if desired), and displaying a progress bar with
statistics.

.. note::

    This draws heavily from the
    `MNE-python <https://martinos.org/mne>`_ ``_fetch_file`` function.

_This package doesn't get a ton of developer attention, but is hopefully well-scoped
enough that it should still be useful! If you'd like to help improve it, fix bugs, etc,
please reach out in the issues!_

Installation
------------

Either clone this repository and install with::

  python setup.py install

or, simply install with ``pip``::

  pip install download

Usage
-----

Download a file on the web is as easy as::

  from download import download
  path = download(url, file_path)

a file called ``file_name`` will be downloaded to the folder of ``file_path``.

File types
^^^^^^^^^^

If your file is a zip file, you can add the flag::

  path = download(url, file_path, kind="zip")

in this case, the file will be downloaded, and then unzipped into the folder
specified by `file_name`.

Supported formats are `'file', 'zip', 'tar', 'tar.gz'`
Defaults to `file`.

Progress bar
^^^^^^^^^^^^

Whether to display a progress bar during file download.
Defaults to `True`::

  path = download(url, file_path, progressbar=True)

Replace
^^^^^^^

If `True` and the URL points to a single file, overwrite the old file if possible.
Defaults to `False`::

  path = download(url, file_path, replace=False)

Timeout
^^^^^^^

The URL open timeout in seconds.
Defaults to 10 seconds::

  path = download(url, file_path, timeout=10)

Verbose
^^^^^^^

Whether to print download status to the screen.
Defaults to `True`::

  path = download(url, file_path, verbose=True)


Frequently Asked Questions
--------------------------

.. _faq/file-size:

Why do I occasionally get a "Error file size is..." error?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Occasionally, when you try to download a file, the server from
which you are downloading will return that the download is finished,
when it is not. ``download`` will check whether the final downloaded
file is the correct size. If not, it will throw this error. In this case,
you should try re-downloading the file.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/choldgraf/download",
    "name": "download",
    "maintainer": "Chris Holdgraf",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "choldgraf@gmail.com",
    "keywords": "",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/3c/6e/1fd2e220b42858e2fb0e5fe870404210d003f151930e62b58675223444d0/download-0.3.5.tar.gz",
    "platform": "any",
    "description": ".. image:: https://codecov.io/gh/choldgraf/download/branch/master/graph/badge.svg\n  :target: https://codecov.io/gh/choldgraf/download\n  :align: left\n\n.. image:: https://circleci.com/gh/choldgraf/download.svg?style=svg\n    :target: https://circleci.com/gh/choldgraf/download\n    :align: left\n\nDownload\n--------\nA no-frills tool to download files from the web. It will\nattempt to be smart about not downloading data that's\nalready there, checking to make sure that\nthere were no errors in fetching data, automatically unzipping the contents\nof downloaded zipfiles (if desired), and displaying a progress bar with\nstatistics.\n\n.. note::\n\n    This draws heavily from the\n    `MNE-python <https://martinos.org/mne>`_ ``_fetch_file`` function.\n\n_This package doesn't get a ton of developer attention, but is hopefully well-scoped\nenough that it should still be useful! If you'd like to help improve it, fix bugs, etc,\nplease reach out in the issues!_\n\nInstallation\n------------\n\nEither clone this repository and install with::\n\n  python setup.py install\n\nor, simply install with ``pip``::\n\n  pip install download\n\nUsage\n-----\n\nDownload a file on the web is as easy as::\n\n  from download import download\n  path = download(url, file_path)\n\na file called ``file_name`` will be downloaded to the folder of ``file_path``.\n\nFile types\n^^^^^^^^^^\n\nIf your file is a zip file, you can add the flag::\n\n  path = download(url, file_path, kind=\"zip\")\n\nin this case, the file will be downloaded, and then unzipped into the folder\nspecified by `file_name`.\n\nSupported formats are `'file', 'zip', 'tar', 'tar.gz'`\nDefaults to `file`.\n\nProgress bar\n^^^^^^^^^^^^\n\nWhether to display a progress bar during file download.\nDefaults to `True`::\n\n  path = download(url, file_path, progressbar=True)\n\nReplace\n^^^^^^^\n\nIf `True` and the URL points to a single file, overwrite the old file if possible.\nDefaults to `False`::\n\n  path = download(url, file_path, replace=False)\n\nTimeout\n^^^^^^^\n\nThe URL open timeout in seconds.\nDefaults to 10 seconds::\n\n  path = download(url, file_path, timeout=10)\n\nVerbose\n^^^^^^^\n\nWhether to print download status to the screen.\nDefaults to `True`::\n\n  path = download(url, file_path, verbose=True)\n\n\nFrequently Asked Questions\n--------------------------\n\n.. _faq/file-size:\n\nWhy do I occasionally get a \"Error file size is...\" error?\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nOccasionally, when you try to download a file, the server from\nwhich you are downloading will return that the download is finished,\nwhen it is not. ``download`` will check whether the final downloaded\nfile is the correct size. If not, it will throw this error. In this case,\nyou should try re-downloading the file.\n\n\n",
    "bugtrack_url": null,
    "license": "BSD (3-clause)",
    "summary": "A quick module to help downloading files using python.",
    "version": "0.3.5",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "374501e7455a9659528e77a414b222326d4c525796e4f571bbabcb2e0ff3d1f4",
                "md5": "362d05293a0e9a85b90f6f1de42abf33",
                "sha256": "8b2f7695745254b0bebdfb789d426b35768366054538b4f8e7f9377dd5a9499d"
            },
            "downloads": -1,
            "filename": "download-0.3.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "362d05293a0e9a85b90f6f1de42abf33",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8849,
            "upload_time": "2020-04-23T22:02:44",
            "upload_time_iso_8601": "2020-04-23T22:02:44.911038Z",
            "url": "https://files.pythonhosted.org/packages/37/45/01e7455a9659528e77a414b222326d4c525796e4f571bbabcb2e0ff3d1f4/download-0.3.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c6e1fd2e220b42858e2fb0e5fe870404210d003f151930e62b58675223444d0",
                "md5": "95b912e1aa86d9b7193329532e6c1fe7",
                "sha256": "884a885475b3cdbec0aa277e41643995c3394a1e064a0816f53fffae4a382130"
            },
            "downloads": -1,
            "filename": "download-0.3.5.tar.gz",
            "has_sig": false,
            "md5_digest": "95b912e1aa86d9b7193329532e6c1fe7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8047,
            "upload_time": "2020-04-23T22:02:46",
            "upload_time_iso_8601": "2020-04-23T22:02:46.136612Z",
            "url": "https://files.pythonhosted.org/packages/3c/6e/1fd2e220b42858e2fb0e5fe870404210d003f151930e62b58675223444d0/download-0.3.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-04-23 22:02:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "choldgraf",
    "github_project": "download",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "circle": true,
    "lcname": "download"
}
        
Elapsed time: 0.03225s