import requests


def post_file(input_filepath, input_format, output_format):
    """Posts a file to the REST API and converts between the given formats."""
    with open(input_filepath) as input_file:
        input_text = input_file.read()
        url = 'http://localhost:5000/convert/{}/{}'.format(
            input_format, output_format)
        return requests.post(url, files={'input': input_text})