0
다음 코드 샘플은 http://python-gitlab.readthedocs.io/en/stable/gl_objects/projects.html#file-uploads의 설명서에있는 수정 된 버전입니다.Python Gitlab 파일 업로드 샘플을 얻는 방법
단일 키 'upload_file'로 AttributeError를받는 경우. 그런 다음 project.upload_file() 속성을 project.upload()로 업데이트하십시오.
@JonathanPorter에게 감사드립니다. project
모듈은 upload_file
라는 이름의 속성이 없기 때문에
project = gl.projects.get('vogon/bypass')
issue = project.issues.get(42)
try:
# note: use project.upload() not project.upload_file()
uploaded_file = project.upload("the_answer_to_life.txt",
filedata="data")
issue.notes.create({
"body": "See the [attached file]
({})".format(uploaded_file["url"])
})
except Exception as e:
self.log.debug(e[0])
'project' 모듈에'upload_file'이라는 속성이 없으므로 속성 오류가 나타납니다. 명시 적으로 가져 와서 속성을 정의해야합니다. –
감사! @JonathanPorter 설명서에 약간의 불일치가있을 수 있습니다. project.upload_file() 대신 project.upload() 속성을 업데이트했습니다. –