Metadata-Version: 2.1
Name: uploadcare-migro
Version: 1.8.0
Summary: Uploadcare migration tool
Home-page: https://github.com/uploadcare/migro
Author: Uploadcare team
Author-email: hello@uploadcare.com
License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
License-File: LICENSE
Requires-Dist: aiohttp (==3.8.1)
Requires-Dist: click (==8.1.3)
Requires-Dist: colorama (==0.4.4)
Requires-Dist: python-dateutil (==2.8.2)
Requires-Dist: tqdm (==4.64.0)

================================
MIGRO: Uploadcare migration tool
================================

Migro helps you migrate to Uploadcare from other cloud file management
services like Filestack, Cloudinary, etc.
Currently, we support migrating from Filestack, but you can migrate
from other services too: you'll just need to provide your file URLs for import.

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

This utility requires Python version 3.8 or later.

In order to install ``migro``, simply run:

.. code-block:: console

  $ pip install uploadcare-migro


Usage
-----
.. code-block:: console

    $ migro <PUBLIC_KEY> <INPUT_FILE>

Where:

``<PUBLIC_KEY>`` — Your Uploadcare project `public key`_.

``<INPUT_FILE>`` — A text file containing a list of file URLs
to be uploaded to your Uploadcare project.

Other options:

.. code-block::

  -v, --version               Show utility version and quit.

  -h, --help                  Show this help and quit.

  --output_file FILE          Path to a Migro output file.  [default:
                              migro_result.txt]

  --upload_base TEXT          Base URL for uploads.  [default:
                              https://upload.uploadcare.com/]

  --from_url_timeout FLOAT    Number of seconds to wait till the file will be
                              processed by `from_url` upload.  [default: 30]

  --max_uploads INTEGER       Maximum number of upload requests running in
                              'parallel'.  [default: 20]

  --check_interval FLOAT      Number of seconds in between status check
                              requests.


Output file format
------------------

The output file format is quite simple.
For each input file URL or Filestack file handle, there are 3 columns divided by the \t symbol (tab).

The first column holds input file URL or Filestack handle itself,
second column — upload operation status: success or fail,
third column — output Uploadcare URL or error description.

For instance, you're willing to migrate the three following files to Uploadcare
where the first two are presented as URLs and the third one as Filestack file
handle. Also, that's how your input text file will then be structured:

.. code-block::

    https://cdn.filestackcontent.com/YBLVVdUpRqC4nOynxDd8
    https://www.facebook.com/rsrc.php/v3/y7/r/dTQOHZm7Z-3.svg
    uNWvPRXJQmO49MJbPZn9

That's what you get in your Migro output file for those input entries:

.. code-block::

    https://cdn.filestackcontent.com/YBLVVdUpRqC4nOynxDd8       success     https://ucarecdn.com/d8f8de4b-f92e-41a0-b7f9-28fd4baad9ae/
    https://www.facebook.com/rsrc.php/v3/y7/r/dTQOHZm7Z-3.svg   success     https://ucarecdn.com/4a03f3d4-2bd3-456e-89a5-008190980248/
    https://cdn.filestackcontent.com/uNWvPRXJQmO49MJbPZn9       fail        Uploading of these files types is not allowed on your current plan.

How migration works
-------------------

The migration itself is fairly simple: you provide a list of file URLs
or Filestack file handlers, and those files get uploaded to your Uploadcare
project. That's it.
Migro does not download any files. It makes use of the
`Uploading API`_.
Specifically, it utilizes the ``From URL``
method_.

As a result, you'll get a listing of all the uploaded files.
For every processed file, you're also getting its status and errors,
in case there were any.

Examples
--------

Here's how you run the utility:

.. code-block::

    $ migro 9a598e2a47fe961ea412 fileslist.txt --output_file /tmp/migro-result.txt

And that's what you get:

.. code-block::

    Upload progress: 100%|████████████████████████████████████████████████| 6/6 [00:03<00:00,  1.74s/file]
    All files have been processed, output URLs were written to: are here: /tmp/migro_result.txt
    Number of failed files: 1
    Thanks for your interest in Uploadcare.
    Hit us up at help@uploadcare.com in case of any questions.

Note for windows users
----------------------

Currently there is an issue with program termination by CTRL+C on Windows, so
program can no be terminated correctly by this way.

This is a platform dependent python programming language issue.


Alternatives
------------

You can use our libs_
to migrate your files from any source.

.. _Uploading API: https://uploadcare.com/documentation/upload/
.. _method: https://uploadcare.com/documentation/upload/#from-url
.. _public key: https://uploadcare.com/documentation/keys/
.. _libs: https://uploadcare.com/documentation/libs/

