def upload(self, filepath):
        """Uploads file from filepath to Redmine and returns an assigned token"""
        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 __HOLE__:
            raise NoFileError

        return response['upload']['token']
dataset/ETHPy150Open maxtepkeev/python-redmine/redmine/__init__.py/Redmine.upload