def upload(self, filepath):
        if self.ver is not None and LooseVersion(str(self.ver)) < LooseVersion('1.4.0'):
            raise VersionMismatchError('File upload')

        try:
            with open(filepath, 'rb') as stream:
                url = '{0}{1}'.format(self.url, '/uploads.json')
                response = self.request('post', url, data=stream, headers={'Content-Type': 'application/octet-stream'})
        except IOError:
            raise NoFileError

        return response['upload']['token']
Uploads file from filepath to Redmine and returns an assigned token
dataset/ETHPy150Open maxtepkeev/python-redmine/redmine/__init__.py/Redmine.upload