Commit 60f581c0 authored by Klaus Wölfel's avatar Klaus Wölfel

wendelin_relay: support forwarding to multiple wendelin

parent 5ac6e94f
...@@ -7,16 +7,20 @@ import urllib ...@@ -7,16 +7,20 @@ import urllib
import urllib2 import urllib2
def IngestionPolicy_forward(self, reference, data_chunk): def IngestionPolicy_forward(self, reference, data_chunk):
configuration_dict = self.IngestionPolicy_getWendelinRelayConfigurationDict() for configuration_dict in \
if not configuration_dict["wendelin_url"]: self.IngestionPolicy_getWendelinRelayConfigurationDictList():
return if not configuration_dict["wendelin_url"]:
data = urllib.urlencode({'data_chunk': data_chunk}) return
url = "%s/%s/ingest?reference=%s" %(configuration_dict["wendelin_url"], data = urllib.urlencode({'data_chunk': data_chunk})
self.getRelativeUrl(), url = "%s/%s/ingest?reference=%s" %(configuration_dict["wendelin_url"],
reference) self.getRelativeUrl(),
request = urllib2.Request(url, data) reference)
base64string = base64.encodestring('%s:%s' % ( request = urllib2.Request(url, data)
configuration_dict["username"], base64string = base64.encodestring('%s:%s' % (
configuration_dict["password"])).replace('\n', '') configuration_dict["username"],
request.add_header("Authorization", "Basic %s" % base64string) configuration_dict["password"])).replace('\n', '')
urllib2.urlopen(request, timeout=configuration_dict["timeout"]) request.add_header("Authorization", "Basic %s" % base64string)
\ No newline at end of file try:
urllib2.urlopen(request, timeout=configuration_dict["timeout"])
except:
pass
...@@ -45,7 +45,9 @@ ...@@ -45,7 +45,9 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple/> <tuple>
<string>W: 25, 4: No exception type(s) specified (bare-except)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>IngestionPolicy_getWendelinRelayConfigurationDict</string> </value> <value> <string>IngestionPolicy_getWendelinRelayConfigurationDictList</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment