Skip to content

Commit 2829506

Browse files
authored
Merge pull request #451 from Shuffle/fix/send-sms-email-regional-url
feat: use regional url for send_sms and send_email
2 parents 576f9c7 + 37f7ec8 commit 2829506

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

shuffle-tools/1.2.0/src/app.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ def send_sms_shuffle(self, apikey, phone_numbers, body):
191191

192192
data = {"numbers": targets, "body": body}
193193

194-
url = "https://shuffler.io/api/v1/functions/sendsms"
194+
# this is just to expose this feature to onprem users as well
195+
base = self.url if "shuffler.io" in self.url or "run.app" in self.url else "https://shuffler.io"
196+
url = "%s/api/v1/functions/sendsms" % base
195197
headers = {"Authorization": "Bearer %s" % apikey}
196198
return requests.post(url, headers=headers, json=data, verify=False).text
197199

@@ -226,7 +228,9 @@ def send_email_shuffle(self, apikey, recipients, subject, body, attachments=""):
226228
except Exception as e:
227229
pass
228230

229-
url = "https://shuffler.io/functions/sendmail"
231+
# this is just to expose this feature to onprem users as well
232+
base = self.url if "shuffler.io" in self.url or "run.app" in self.url else "https://shuffler.io"
233+
url = "%s/functions/sendmail" % base
230234
headers = {"Authorization": "Bearer %s" % apikey}
231235
return requests.post(url, headers=headers, json=data).text
232236

0 commit comments

Comments
 (0)