Skip to content

Small fixes #15

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ from soarsdk.client import PhantomClient
phantom: PhantomClient = PhantomClient(username='username', password='password')

# Token Authentication
phantom: PhantomClient = PhantomClient(token='token_string')
phantom: PhantomClient = PhantomClient(splunkToken='token_string')

~~~

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["wheel", 'setuptools==64.0.0']
requires = ["wheel", 'setuptools']
[project]
name = "soarsdk"
version = "1.0.1"
Expand Down
12 changes: 4 additions & 8 deletions src/soarsdk/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ def connect(
splunkToken (str): Splunk SOAR generated token
"""
if kwargs.get("username") and kwargs.get("password"):
self.session = self.password_authenticate(
self.password_authenticate(
kwargs["username"], kwargs["password"]
)
if kwargs.get("splunkToken"):
self.session = self.token_authenticate(kwargs["splunkToken"])
self.token_authenticate(kwargs["splunkToken"])

self.test_authorization()

Expand All @@ -136,12 +136,8 @@ def password_authenticate(self, username: str, password: str):
username (str): username for authentication
password (str): password for authentication
"""
url: str = self.base_url + "browse"
response: requests.Response = self.session.get(
self.base_url, auth=(username, password), verify=False
)
response.raise_for_status()
self._set_session_headers()

self.session.auth = (username, password)
self.test_authorization()
username = None
password = None
Expand Down