Created
March 14, 2022 09:07
-
-
Save gallypette/8e4fc941443a2483b6b2fcaee4c76e47 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyail import PyAIL | |
import sys | |
import json | |
import uuid | |
ail_url = 'https://yourailIP:7000' | |
ail_key = '' | |
source_uuid = "{}".format(uuid.uuid4()) | |
ailfeedertype = "ail_feeder_jabber" | |
try: | |
pyail = PyAIL(ail_url, ail_key, ssl=False) | |
except Exception as e: | |
print(e) | |
sys.exit(0) | |
for content in sys.stdin: | |
elm = json.loads(content) | |
tmp = elm['en'] | |
tmpmt = {} | |
tmpmt['jabber:to'] = elm['to'] | |
tmpmt['jabber:from'] = elm['from'] | |
tmpmt['jabber:ts'] = elm['timestamp'] | |
tmpmt['jabber:id'] = "{}".format(uuid.uuid4()) | |
pyail.feed_json_item(tmp, tmpmt, ailfeedertype, source_uuid) | |
~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment