Skip to content

Commit

Permalink
Merge branch 'AntoniaBK-Send_mail_api'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Mar 27, 2024
2 parents 459e9e5 + 27b0006 commit 85e7532
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pylookyloo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,4 +460,11 @@ def get_modules_responses(self, tree_uuid: str) -> Dict[str, Any]:
:param capture_uuid: UUID of the capture
'''
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json', tree_uuid, 'modules'))))
return r.json()
return r.json()

def send_mail(self, tree_uuid: str, email: str = '', comment: str | None = None) -> bool | dict[str, Any]:
to_send = {'email': email}
if comment:
to_send['comment'] = comment
r = self.session.post(urljoin(self.root_url, str(PurePosixPath('json', tree_uuid, 'report'))), json=to_send)
return r.json()

0 comments on commit 85e7532

Please sign in to comment.