def save_request_content_to_file(request, archive_target_path, url_key,
                                 data_type='unknown'):
    if url_key in request.args:
        if request.data or 'Transfer-Encoding' in request.headers:
            raise manager_exceptions.BadParametersError(
                    "Can't pass both a {0} URL via query parameters "
                    "and {0} data via the request body at the same time"
                    .format(data_type))
        data_url = request.args[url_key]
        try:
            with contextlib.closing(urlopen(data_url)) as urlf:
                with open(archive_target_path, 'w') as f:
                    f.write(urlf.read())
        except URLError:
            raise manager_exceptions.ParamUrlNotFoundError(
                    "URL {0} not found - can't download {1} archive"
                    .format(data_url, data_type))
        except ValueError:
            raise manager_exceptions.BadParametersError(
                    "URL {0} is malformed - can't download {1} archive"
                    .format(data_url, data_type))

    elif 'Transfer-Encoding' in request.headers:
        with open(archive_target_path, 'w') as f:
            for buffered_chunked in chunked.decode(request.input_stream):
                f.write(buffered_chunked)
    else:
        if not request.data:
            raise manager_exceptions.BadParametersError(
                    'Missing {0} archive in request body or '
                    '"{1}" in query parameters'.format(data_type,
                                                       url_key))
        uploaded_file_data = request.data
        with open(archive_target_path, 'w') as f:
            f.write(uploaded_file_data)
Returns a list of all dynamic properties defined for instance.
dataset/ETHPy150Open cloudify-cosmo/cloudify-manager/rest-service/manager_rest/utils.py/save_request_content_to_file--crossover with--dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/ext/db/__init__.py/Model.dynamic_properties