Skip to content

Commit

Permalink
Set a default path in the URL for ICAT and IDS respectively. Close #63.
Browse files Browse the repository at this point in the history
  • Loading branch information
RKrahl committed Dec 19, 2019
1 parent 7c2da17 commit dad6078
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

* Version 0.17.0 (not yet published)

** New features

+ #63: Set a default path in the URL for ICAT and IDS respectively.

** Incompatible changes and deprecations

+ Deprecate support for Python 2.
Expand Down
12 changes: 10 additions & 2 deletions icat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import logging
from distutils.version import StrictVersion as Version
import atexit
import urlparse

import suds
import suds.client
Expand Down Expand Up @@ -140,6 +141,13 @@
study = icat.entities.Study410,
user = icat.entities.User410 )

def _complete_url(url, default_path="/ICATService/ICAT?wsdl"):
if not url:
return url
o = urlparse.urlparse(url)
if o.path or o.query:
return url
return "%s://%s%s" % (o.scheme, o.netloc, default_path)

class Client(suds.client.Client):

Expand Down Expand Up @@ -197,10 +205,10 @@ def __init__(self, url, **kwargs):
:see: :class:`suds.options.Options` for the keyword arguments.
"""

self.url = url
self.url = _complete_url(url)
self.kwargs = dict(kwargs)

idsurl = kwargs.pop('idsurl', None)
idsurl = _complete_url(kwargs.pop('idsurl', None), default_path="/ids")

sslverify = kwargs.pop('checkCert', True)
cafile = kwargs.pop('caFile', None)
Expand Down

0 comments on commit dad6078

Please sign in to comment.