Attachment

Supported by Redmine starting from version 1.3

Manager

All operations on the Attachment resource are provided by it’s manager. To get access to it you have to call redmine.attachment where redmine is a configured redmine object. See the Configuration about how to configure redmine object.

Create methods

Not supported by Redmine. Some resources support adding attachments via it’s create/update methods, e.g. Issue, WikiPage.

Read methods

get

redminelib.managers.ResourceManager.get(resource_id)

Returns single Attachment resource from Redmine by it’s id.

Parameters:resource_id (int) – (required). Id of the attachment.
Returns:Resource object
>>> attachment = redmine.attachment.get(76905)
>>> attachment
<redminelib.resources.Attachment #76905 "1(a).png">

Hint

Attachment can be easily downloaded via the provided download() method which is a proxy to the redmine.download() method which provides several options to control the saving process (see docs for details):

>>> attachment = redmine.attachment.get(76905)
>>> filepath = attachment.download(savepath='/usr/local/', filename='image.jpg')
>>> filepath
'/usr/local/image.jpg'

all

Not supported by Redmine

filter

Not supported by Redmine

Update methods

Not supported by Redmine

Delete methods

New in version 2.0.0.

Requires Redmine >= 3.3.0

redminelib.managers.ResourceManager.delete(resource_id)

Deletes single Attachment resource from Redmine by it’s id.

Parameters:resource_id (int) – (required). Version id.
Returns:True
>>> redmine.attachment.delete(76905)
True
redminelib.resources.Attachment.delete()

Deletes current Attachment resource object from Redmine.

Returns:True
>>> attachment = redmine.attachment.get(76905)
>>> attachment.delete()
True

Export

Not supported by Redmine