Skip to content

Update jira.py add_attachment method #1126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 23, 2023

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