Skip to content

Commit f611372

Browse files
author
Sam Stelle
committed
Merge branch 'feature/storage_passwords' of https://github.com/splunk/splunk-sdk-python into feature/storage_passwords
2 parents ea151b3 + c52c0b1 commit f611372

File tree

12 files changed

+417
-43
lines changed

12 files changed

+417
-43
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ examples/*/local
1717
examples/*/metadata
1818
tests/searchcommands_data/log/
1919
tests/searchcommands_data/output/
20+
examples/searchcommands_app/searchcommand_app.log
21+
Test Results*.html

examples/searchcommands_app/bin/generatehello.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616

1717
import sys, time
1818
from splunklib.searchcommands import \
19-
dispatch, GeneratingCommand, Configuration, Option, validators
19+
dispatch, GeneratingCommand, Configuration, Option, validators
2020

2121
@Configuration()
2222
class GenerateHelloCommand(GeneratingCommand):
23-
count = Option(require=True, validate=validators.Integer())
23+
count = Option(require=True, validate=validators.Integer())
2424

25-
def generate(self):
26-
for i in range(1, self.count + 1):
27-
text = 'Hello World %d' % i
28-
yield {'_time': time.time(), 'event_no': i, '_raw': text }
25+
def generate(self):
26+
for i in range(1, self.count + 1):
27+
text = 'Hello World %d' % i
28+
yield {'_time': time.time(), 'event_no': i, '_raw': text }
2929

3030
dispatch(GenerateHelloCommand, sys.argv, sys.stdin, sys.stdout, __name__)

examples/searchcommands_template/bin/generate.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66

77
@Configuration()
88
class %(command.title())Command(GeneratingCommand):
9-
""" %(synopsis)
9+
""" %(synopsis)
1010
11-
##Syntax
11+
##Syntax
1212
13-
%(syntax)
13+
%(syntax)
1414
15-
##Description
15+
##Description
1616
17-
%(description)
17+
%(description)
1818
19-
"""
20-
def generate(self):
19+
"""
20+
def generate(self):
2121
# Put your event code here
2222
pass
2323

examples/searchcommands_template/bin/stream.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88
@Configuration()
99
class %(command.title())Command(StreamingCommand):
10-
""" %(synopsis)
10+
""" %(synopsis)
1111
12-
##Syntax
12+
##Syntax
1313
14-
%(syntax)
14+
%(syntax)
1515
16-
##Description
16+
##Description
1717
18-
%(description)
18+
%(description)
1919
20-
"""
21-
def stream(self, events):
20+
"""
21+
def stream(self, events):
2222
# Put your event transformation code here
2323
pass
2424

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def exclude(path):
186186
packages = ["splunklib",
187187
"splunklib.modularinput",
188188
"splunklib.searchcommands",
189-
"splunklib.searchcommands.csv"],
189+
"splunklib.searchcommands.splunk_csv"],
190190

191191
url="http://github.com/splunk/splunk-sdk-python",
192192

splunklib/binding.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,14 @@ class UrlEncoded(str):
115115
UrlEncoded('ab c') + 'de f' == UrlEncoded('ab cde f')
116116
'ab c' + UrlEncoded('de f') == UrlEncoded('ab cde f')
117117
"""
118-
def __new__(self, val='', skip_encode=False):
118+
def __new__(self, val='', skip_encode=False, encode_slash=False):
119119
if isinstance(val, UrlEncoded):
120120
# Don't urllib.quote something already URL encoded.
121121
return val
122122
elif skip_encode:
123123
return str.__new__(self, val)
124+
elif encode_slash:
125+
return str.__new__(self, urllib.quote_plus(val))
124126
else:
125127
# When subclassing str, just call str's __new__ method
126128
# with your class and the value you want to have in the
@@ -464,7 +466,7 @@ def connect(self):
464466
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
465467
if self.scheme == "https":
466468
sock = ssl.wrap_socket(sock)
467-
sock.connect((self.host, self.port))
469+
sock.connect((socket.gethostbyname(self.host), self.port))
468470
return sock
469471

470472
@_authentication

0 commit comments

Comments
 (0)