Skip to content

Commit 128eb8f

Browse files
author
Kevin D Smith
committed
Add REST connection example
1 parent 9a60825 commit 128eb8f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

doc/source/getting-started.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ User names and passwords can be implemented in various ways, so you may need to
1616
system administrator on how to acquire an account.
1717

1818
To connect to a CAS server, you simply import SWAT and use the :class:`swat.CAS` class
19-
to create a connection.
19+
to create a connection. This has a couple of different forms. The most
20+
basic is to pass the hostname, port, userid, and password.
2021

2122
.. ipython:: python
2223
:suppress:
@@ -32,6 +33,21 @@ to create a connection.
3233
import swat
3334
conn = swat.CAS(host, port, userid, password)
3435
36+
However, if you are using a REST connection to CAS, a URL is the more natural
37+
way to specify a host, port, and protocol.
38+
39+
.. ipython:: python
40+
:verbatim:
41+
42+
conn = swat.CAS('https://my-cas-host.com:443/cas-shared-default-http/',
43+
userid='...', password='...')
44+
45+
Notice that in the URL case, ``userid`` and ``password``, must be specified
46+
as keyword parameters since the ``port`` parameter is being skipped. Also,
47+
in this case we are using a proxy server that requires the base path
48+
of 'cas-shared-default-http'. If you are connecting directly to a CAS
49+
server, this is typically not required.
50+
3551
Now that we have a connection to CAS, we can run some actions on it.
3652

3753
Running CAS Actions

0 commit comments

Comments
 (0)