# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):


import argparse
import json
import logging
import os
import boto
  from BytesIO import BytesIO
  from io import BytesIO
from six.moves.urllib.parse import urlparse
from auto_forensicate import errors
    if base_path:
      remote_path = '/'.join([base_path, remote_path])

    if destination:
      remote_path = '/'.join([remote_path, destination])

    remote_path = '/'.join([self._bucket_name, remote_path])

    return remote_path

  def _UploadStream(self, stream, remote_path, update_callback=None):
    """Uploads a file object to Google Cloud Storage.

    Args:
      stream (file): the file-like object pointing to data to upload.
      remote_path (str): the remote path to store the data to.
      update_callback (func): an optional function called as upload progresses.
    Raises:
      errors.RetryableError: when the upload encounters an error that's worth
        retrying.
    """
    if not self._boto_configured:
      self._InitBoto()

    try:
      dst_uri = boto.storage_uri(remote_path, u'gs')
      dst_uri.new_key().set_contents_from_stream(stream, cb=update_callback)
    except boto.exception.GSDataError as e:
      # This is usually raised when the connection is broken, and deserves to
      # be retried.

# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):


# Path: auto_forensicate/uploader.py
import argparse
import json
import logging
import os
import boto
  from BytesIO import BytesIO
  from io import BytesIO
from six.moves.urllib.parse import urlparse
from auto_forensicate import errors

    if base_path:
      remote_path = '/'.join([base_path, remote_path])

    if destination:
      remote_path = '/'.join([remote_path, destination])

    remote_path = '/'.join([self._bucket_name, remote_path])

    return remote_path

  def _UploadStream(self, stream, remote_path, update_callback=None):
    """Uploads a file object to Google Cloud Storage.

    Args:
      stream (file): the file-like object pointing to data to upload.
      remote_path (str): the remote path to store the data to.
      update_callback (func): an optional function called as upload progresses.
    Raises:
      errors.RetryableError: when the upload encounters an error that's worth
        retrying.
    """
    if not self._boto_configured:
      self._InitBoto()

    try:
      dst_uri = boto.storage_uri(remote_path, u'gs')
      dst_uri.new_key().set_contents_from_stream(stream, cb=update_callback)
    except boto.exception.GSDataError as e:
      # This is usually raised when the connection is broken, and deserves to
      # be retried.

      raise errors.RetryableError(str(e))