Giter Site home page Giter Site logo

atlassian-labs / transfer-api-ref-client Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 7.0 32 KB

Reference API implementation that supports large file uploads (>100GB) in a chunked and resumable fashion to https://transfer.atlassian.com

Home Page: https://transfer.atlassian.com

License: Apache License 2.0

Python 97.88% Dockerfile 2.12%
transfer

transfer-api-ref-client's Introduction

transfer-api-ref-client

Atlassian license version Python version Build Status PRs Welcome

Welcome to the reference API client implementation for the transfer.atlassian.com REST API. This client is provided as a reference implementation for the provided REST API which allows resumable and chunked file uploads to https://transfer.atlassian.com. It is provided as a command-line tool (CLI).

The tool performs file upload by chunks and can resume file upload after failures. If you are faced with failure during file upload, you can run the tool again and the tool skip chunks uploaded before and upload the missed file fragments automatically.

Usage (simple)

  1. Install the client. Refer: Installation

  2. First, obtain an API token from transfer.atlassian.com/auth_token

  3. Then use your favorite terminal to run the reference client to upload one or multiple files:

python app.py \
    --file <FILE NAME 1> \
    --file <FILE NAME 2> \
    --issue_key=<ISSUE_KEY, eg. SUPTST-1234> \
    --user=<API USER ID> \
    --auth_token=<API TOKEN>

Note: --issue-key needs to refer to an existing open Support issue in the Atlassian's Support System where you have proper permissions to add attachments.

Using Docker

It is possible to build a local Docker image which has all the necessary dependencies added. The tool can then be run by just running the container.

Steps:

  1. Build the image: docker build -t transfer-reference-client .

  2. Run the following command line to upload a file:

    docker run --rm -it --name transfer-reference-client \
         --volume <HOST_PATH>/:/upload \
         transfer-reference-client:latest \
         --file /upload/<FILE_NAME> \
         --issue_key=<ISSUE_KEY> \
         --user=<API_USER_ID> \
         --auth_token=<API_TOKEN>
    

Installation

  1. Make sure you use Python3:

    $ which python 
    

    It should point to a Python3 installation

  2. Clone this repository

  3. Install the dependencies:

    pip install -r requirements.txt
    
  4. (Optional) Run tests to ensure your environment is working properly

    python -m unittest tests/*.py -v
    

Development

For development we recommend use Python virtual environment:

$ virtualenv -p `which python3` .venv
$ source .venv/bin/activate
$ pip install -r requirements.txt
$ python -m unittest tests/*.py -v

Tests

The existing tests are located in the tests/ folder. They do not actually check full connectivity to the API but check the contract implementation.

You can run the tests using: python -m unittest tests/*.py -v

Contributions

Contributions to transfer-api-ref-client are welcome! Please see CONTRIBUTING.md for details.

License

Copyright (c) 2020 Atlassian and others. Apache 2.0 licensed, see LICENSE file.


With �� from Atlassian

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.