Skip to content

Commit

Permalink
s/url/discovery_url/r
Browse files Browse the repository at this point in the history
  • Loading branch information
orsinium committed Oct 8, 2019
1 parent 78ffca6 commit 6c3d496
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions cabby/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


def create_client(host=None, port=None, discovery_path=None, use_https=False,
url=None, version="1.1", headers=None):
discovery_url=None, version="1.1", headers=None):
'''Create a client instance (TAXII version specific).
``host``, ``port``, ``use_https``, ``discovery_path`` values
Expand All @@ -25,16 +25,17 @@ def create_client(host=None, port=None, discovery_path=None, use_https=False,
:param int port: TAXII server port
:param str discovery_path: Discovery Service relative path
:param bool use_https: if HTTPS should be used
:param string url: URL to infer host, port, discovery_path, and use_https
:param string discovery_url: URL to infer host, port, discovery_path,
and use_https.
:param string version: TAXII version (1.1 or 1.0)
:param dict headers: additional headers to pass with TAXII messages
:return: client instance
:rtype: :py:class:`cabby.client11.Client11` or
:py:class:`cabby.client10.Client10`
'''
if url:
parsed = urlparse(url)
if discovery_url:
parsed = urlparse(discovery_url)
if not host and parsed.hostname:
host = parsed.hostname
if not port and parsed.port:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

def test_url_parse():
url = 'https://eiq-test.com:1337/path/to/discovery'
client = cabby.create_client(url=url)
client = cabby.create_client(discovery_url=url)
assert client.host == 'eiq-test.com'
assert client.port == 1337
assert client.use_https is True
Expand Down

0 comments on commit 6c3d496

Please sign in to comment.