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

wendelin_relay: support forwarding to multiple wendelin

parent 5ac6e94f
Pipeline #4350 skipped
......@@ -7,16 +7,20 @@ import urllib
import urllib2
def IngestionPolicy_forward(self, reference, data_chunk):
configuration_dict = self.IngestionPolicy_getWendelinRelayConfigurationDict()
if not configuration_dict["wendelin_url"]:
return
data = urllib.urlencode({'data_chunk': data_chunk})
url = "%s/%s/ingest?reference=%s" %(configuration_dict["wendelin_url"],
self.getRelativeUrl(),
reference)
request = urllib2.Request(url, data)
base64string = base64.encodestring('%s:%s' % (
configuration_dict["username"],
configuration_dict["password"])).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
urllib2.urlopen(request, timeout=configuration_dict["timeout"])
\ No newline at end of file
for configuration_dict in \
self.IngestionPolicy_getWendelinRelayConfigurationDictList():
if not configuration_dict["wendelin_url"]:
return
data = urllib.urlencode({'data_chunk': data_chunk})
url = "%s/%s/ingest?reference=%s" %(configuration_dict["wendelin_url"],
self.getRelativeUrl(),
reference)
request = urllib2.Request(url, data)
base64string = base64.encodestring('%s:%s' % (
configuration_dict["username"],
configuration_dict["password"])).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
try:
urllib2.urlopen(request, timeout=configuration_dict["timeout"])
except:
pass
......@@ -45,7 +45,9 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
<tuple>
<string>W: 25, 4: No exception type(s) specified (bare-except)</string>
</tuple>
</value>
</item>
<item>
......
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>IngestionPolicy_getWendelinRelayConfigurationDict</string> </value>
<value> <string>IngestionPolicy_getWendelinRelayConfigurationDictList</string> </value>
</item>
</dictionary>
</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