Skip to content

Cannot get file upload sample code to work #335

Description

@mshamma

I'm using the following code in a script and cannot get the sample file upload code to work. I also cannot get a meaningful exception from the Python-Gitlab library. The only exception returned is an AttributeError with a single key 'upload_file'.

Using Python 3.6.2 on macOS

project = gl.projects.get('vogon/bypass')
issue = project.issues.get(42)
try:
    uploaded_file = project.upload_file("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])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions