Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 试图通过Python Gitlab api将gz文件上载到Gitlab_Python 3.x_Gitlab - Fatal编程技术网

Python 3.x 试图通过Python Gitlab api将gz文件上载到Gitlab

Python 3.x 试图通过Python Gitlab api将gz文件上载到Gitlab,python-3.x,gitlab,Python 3.x,Gitlab,我正试图通过python gitlab api将一个.gz文件上传到gitlab。然而,我发现唯一可以这样做的文档是通过createfile 我已经尝试使用我的gz文件,但是,我得到的错误代码是 UnicodeDecodeError:“utf-8”编解码器无法解码位置1中的字节0x8b:无效的开始字节 f = project.files.create({'file_path': 'testfile.txt', 'branch': 'maste

我正试图通过python gitlab api将一个.gz文件上传到gitlab。然而,我发现唯一可以这样做的文档是通过createfile

我已经尝试使用我的gz文件,但是,我得到的错误代码是
UnicodeDecodeError:“utf-8”编解码器无法解码位置1中的字节0x8b:无效的开始字节

f = project.files.create({'file_path': 'testfile.txt',
                          'branch': 'master',
                          'content': file_content,
                          'author_email': 'test@example.com',
                          'author_name': 'yourname',
                          'commit_message': 'Create testfile'})

我的预期结果是能够通过API或其他方法将gz文件上载到Gitlab。

我最终使用了paramiko并通过该库进行连接。为了解决这个问题,我最终使用了ssh.exec_命令并键入了我所有的命令,后跟一个\n