Skip to content

Conversation

@laralight
Copy link
Contributor

added logic to add_attachment function

added logic to add_attachment function
@gonchik
Copy link
Member

gonchik commented Feb 23, 2023

Thank you for your PR.
I think it's better to have dedicated method like add_attachment_object()
def add_attachment_object(self, issue_key, attachment): log.warning("Adding attachment...") base_url = self.resource_url("issue") url = "{base_url}/{issue_key}/attachments".format(base_url=base_url, issue_key=issue_key) if attachment: files = {"file": attachment} return self.post(url, headers=self.no_check_headers, files=files)

and rewrite previous method into the next one:
def add_attachment(self, issue_key, filename): with open(filename, "rb") as attachment: return self.add_attachment_object(issue_key, attachment)

updated the code for working with the attachments
new function added -  add_attachment_object
@gonchik gonchik changed the title Update jira.py Update jira.py add_attachment method Feb 23, 2023
@gonchik
Copy link
Member

gonchik commented Feb 23, 2023

that's exact the requested method #1125

@gonchik gonchik merged commit fbe0cd3 into atlassian-api:master Feb 23, 2023
@laralight laralight deleted the add_attachment--issue-1125 branch February 23, 2023 12:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants