Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Shuffle/python-apps
Browse files Browse the repository at this point in the history
  • Loading branch information
0x0elliot committed Nov 29, 2024
2 parents 4d9f033 + 67b16d4 commit 8588369
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 192 deletions.
10 changes: 5 additions & 5 deletions email/1.3.0/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ actions:
- name: recipients
description: The recipients of the email
multiline: false
example: "[email protected],frikky@shuffler.io"
example: "[email protected],support@shuffler.io"
required: true
schema:
type: string
Expand All @@ -51,7 +51,7 @@ actions:
- name: username
description: The SMTP login username
multiline: false
example: "frikky@shuffler.io"
example: "support@shuffler.io"
required: false
schema:
type: string
Expand Down Expand Up @@ -79,14 +79,14 @@ actions:
- name: recipient
description: The receiver(s) of the email
multiline: false
example: "frikky@shuffler.io,frikky@shuffler.io"
example: "support@shuffler.io,test@shuffler.io"
required: true
schema:
type: string
- name: cc_emails
description: cc_emails
multiline: false
example: "frikky@shuffler.io,frikky@shuffler.io"
example: "support@shuffler.io,test@shuffler.io"
required: false
schema:
type: string
Expand Down Expand Up @@ -138,7 +138,7 @@ actions:
- name: username
description: The SMTP login username
multiline: false
example: "frikky@shuffler.io"
example: "support@shuffler.io"
required: true
schema:
type: string
Expand Down
12 changes: 8 additions & 4 deletions email/1.3.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ def send_email_shuffle(self, apikey, recipients, subject, body):
headers = {"Authorization": "Bearer %s" % apikey}
return requests.post(url, headers=headers, json=data).text

def send_email_smtp(
self, smtp_host, recipient, subject, body, smtp_port, attachments="", username="", password="", ssl_verify="True", body_type="html", cc_emails=""
):
def send_email_smtp(self, smtp_host, recipient, subject, body, smtp_port, attachments="", username="", password="", ssl_verify="True", body_type="html", cc_emails=""):
self.logger.info("Sending email to %s with subject %s" % (recipient, subject))
if type(smtp_port) == str:
try:
smtp_port = int(smtp_port)
except ValueError:
return "SMTP port needs to be a number (Current: %s)" % smtp_port

self.logger.info("Pre SMTP setup")
try:
s = smtplib.SMTP(host=smtp_host, port=smtp_port)
except socket.gaierror as e:
Expand All @@ -95,6 +95,7 @@ def send_email_smtp(
else:
s.starttls()

self.logger.info("Pre SMTP auth")
if len(username) > 1 or len(password) > 1:
try:
s.login(username, password)
Expand All @@ -108,6 +109,7 @@ def send_email_smtp(
body_type = "html"

# setup the parameters of the message
self.logger.info("Pre mime multipart")
msg = MIMEMultipart()
msg["From"] = username
msg["To"] = recipient
Expand All @@ -116,10 +118,12 @@ def send_email_smtp(
if cc_emails != None and len(cc_emails) > 0:
msg["Cc"] = cc_emails

self.logger.info("Pre mime check")
msg.attach(MIMEText(body, body_type))

# Read the attachments
attachment_count = 0
self.logger.info("Pre attachments")
try:
if attachments != None and len(attachments) > 0:
print("Got attachments: %s" % attachments)
Expand Down Expand Up @@ -153,7 +157,7 @@ def send_email_smtp(
except Exception as e:
self.logger.info(f"Error in attachment parsing for email: {e}")


self.logger.info("Pre send msg")
try:
s.send_message(msg)
except smtplib.SMTPDataError as e:
Expand Down
26 changes: 0 additions & 26 deletions oauth2-example/1.0.0/Dockerfile

This file was deleted.

53 changes: 0 additions & 53 deletions oauth2-example/1.0.0/api.yaml

This file was deleted.

14 changes: 0 additions & 14 deletions oauth2-example/1.0.0/docker-compose.yml

This file was deleted.

4 changes: 0 additions & 4 deletions oauth2-example/1.0.0/env.txt

This file was deleted.

3 changes: 0 additions & 3 deletions oauth2-example/1.0.0/requirements.txt

This file was deleted.

17 changes: 0 additions & 17 deletions oauth2-example/1.0.0/run

This file was deleted.

61 changes: 0 additions & 61 deletions oauth2-example/1.0.0/src/app.py

This file was deleted.

4 changes: 2 additions & 2 deletions shuffle-subflow/1.0.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
argument = json.dumps({
"information": information,
"parent_workflow": self.full_execution["workflow"]["id"],
"frontend_continue": "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=true" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"]),
"frontend_abort": "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=false" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"]),
"frontend_continue": "%s/forms/%s?authorization=%s&reference_execution=%s&answer=true" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"]),
"frontend_abort": "%s/forms/%s?authorization=%s&reference_execution=%s&answer=false" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"]),
"api_continue": "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=true" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"]),
"api_abort": "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=false" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"]),
})
Expand Down
6 changes: 3 additions & 3 deletions shuffle-subflow/1.1.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ def run_userinput(self, user_apikey, sms="", email="", subflow="", information="
if "shuffle-backend" in frontend_url:
frontend_url = ""

explore_path = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
frontend_continue_url = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
frontend_abort_url = "%s/workflows/%s/run?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
explore_path = "%s/forms/%s?authorization=%s&reference_execution=%s&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
frontend_continue_url = "%s/forms/%s?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
frontend_abort_url = "%s/forms/%s?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
api_continue_url = "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=true&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)
api_abort_url = "%s/api/v1/workflows/%s/execute?authorization=%s&reference_execution=%s&answer=false&source_node=%s" % (frontend_url, self.full_execution["workflow"]["id"], self.full_execution["authorization"], self.full_execution["execution_id"], source_node)

Expand Down
1 change: 1 addition & 0 deletions shuffle-tools/1.2.0/src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import multiprocessing

from walkoff_app_sdk.app_base import AppBase
#from shuffle_sdk import AppBase

class Tools(AppBase):
__version__ = "1.2.0"
Expand Down

0 comments on commit 8588369

Please sign in to comment.