import attaches in youtrack

I am writing a script for migrating from Redmine to Youtrack. All tasks, users and the status of transported fine, but I have a problem with the transfer of attachment files.Could you give an example of how a Python Client Library can attach a local file on issue? In the Import REST API is very little information on the subject.

2 comments
Comment actions Permalink

Hello, Alexey!

You can see the example in trac2youtrack.py. Here it is:

print "Processing attachment [ %s ]" % attach.filename

            if not (attach.author_name in registered_users):

                yt_user, registered_users = process_non_authorised_user(target, registered_users, attach.author_name)

                if yt_user is None :

                    attach.author_name = "guest"

                else:

                    attach.author_name = yt_user

            content = open(urllib.quote(attach.filename))

            target.createAttachment(str(project_ID) + "-" + str(issue.id), attach.filename, content, attach.author_name,

                                    created=attach.time)

In the example above attach.filename is name of the file on disk.

0
Comment actions Permalink

Hello Alexey,

Our team would be very grateful if you could provide us your script for testing and further including it to our import library. Please let us what you think.

Thanks in advance!

0

Please sign in to leave a comment.