import requests


def upload(data):
    r = requests.post('https://coveralls.io/api/v1/jobs', files={
        'json_file': data
    })

    try:
        print(r.json())
    except ValueError:
        raise Exception('Failure to submit data. Response [%s]: %s' % (r.status_code, r.text))  # NOQA

import gzip
import requests


def upload(data):
    r = requests.post('https://coveralls.io/api/v1/jobs', files={
        'json_file': ('json_file', gzip.compress(data), 'gzip/json')
    })

    try:
        print(r.json())
    except ValueError:
        raise Exception('Failure to submit data. Response [%s]: %s' % (r.status_code, r.text))  # NOQA

Compress data sent to Coveralls using gzip
shipit_code_coverage: Compress data sent to Coveralls using gzip
