Skip to content
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

Support for multiple webhooks. #22

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Legacy support for variable name and single webhook.
  • Loading branch information
versx committed Sep 2, 2018
commit fbc32fb0cb3509e46c6cf53c65322775d892c73a
10 changes: 9 additions & 1 deletion raidnearby.py
Original file line number Diff line number Diff line change
@@ -822,7 +822,15 @@ def send_webhook(self, fort_id, lvl, poke_id, end, type_):
type=type_)
payload = json.loads(payload_raw)

for wh in self.config.WEBHOOK:
if hasattr(self.config, 'WEBHOOK'):
webhooks = [self.config.WEBHOOK]

if isinstance(self.config.WEBHOOKS, str):
webhooks = [self.config.WEBHOOKS]
else:
webhooks = self.config.WEBHOOKS

for wh in webhooks:
response = requests.post(
wh, data=json.dumps(payload),
headers={'Content-Type': 'application/json'}