@@ -19,12 +19,12 @@ as you'd use either the `Session` class or the `requests` API.
1919
2020A ` Client ` instance can be constructed either by providing a base URL for all requests along with authentication:
2121
22- from marklogic.client import Client
22+ from marklogic import Client
2323 client = Client('http://localhost:8030', digest=('username', 'password'))
2424
2525Or via separate arguments for each of the parts of a base URL:
2626
27- from marklogic.client import Client
27+ from marklogic import Client
2828 client = Client(host='localhost', port='8030', digest=('username', 'password'))
2929
3030After constructing a ` Client ` instance, each of the methods in the ` requests ` API for sending an HTTP request can be
@@ -43,14 +43,14 @@ Because the `Client` class extends the `Sessions` class, it can be used as a con
4343
4444The ` Client ` constructor includes a ` digest ` argument as a convenience for using digest authentication:
4545
46- from marklogic.client import Client
46+ from marklogic import Client
4747 client = Client('http://localhost:8030', digest=('username', 'password'))
4848
4949An ` auth ` argument is also available for using any authentication strategy that can be configured
5050[ via the requests ` auth ` argument] ( https://requests.readthedocs.io/en/latest/user/advanced/#custom-authentication ) . For
5151example, just like with ` requests ` , a tuple can be passed to the ` auth ` argument to use basic authentication:
5252
53- from marklogic.client import Client
53+ from marklogic import Client
5454 client = Client('http://localhost:8030', auth=('username', 'password'))
5555
5656### MarkLogic Cloud Authentication
@@ -59,26 +59,35 @@ When connecting to a [MarkLogic Cloud instance](https://developer.marklogic.com/
5959the ` cloud_api_key ` and ` base_path ` arguments. You only need to specify a ` host ` as well, as port 443 and HTTPS will be
6060used by default. For example:
6161
62- from marklogic.client import Client
62+ from marklogic import Client
6363 client = Client(host='example.marklogic.cloud', cloud_api_key='some-key-value', base_path='/ml/example/manage')
6464
6565You may still use a full base URL if you wish:
6666
67- from marklogic.client import Client
67+ from marklogic import Client
6868 client = Client('https://example.marklogic.cloud', cloud_api_key='some-key-value', base_path='/ml/example/manage')
6969
70-
70+ MarkLogic Cloud uses an access token for authentication; the access token is generated using the API key value. In some
71+ scenarios, you may wish to set the token expiration time to a value other than the default used by MarkLogic Cloud. To
72+ do so, set the ` cloud_token_duration ` argument to a number greater than zero that defines the token duration in
73+ minutes:
74+
75+ from marklogic import Client
76+ # Sets a token duration of 10 minutes.
77+ client = Client(host='example.marklogic.cloud', cloud_api_key='some-key-value', base_path='/ml/example/manage',
78+ cloud_token_duration=10)
79+
7180## SSL
7281
7382Configuring SSL connections is the same as
7483[ documented for the ` requests ` library] ( https://requests.readthedocs.io/en/latest/user/advanced/#ssl-cert-verification ) .
7584As a convience, the ` Client ` constructor includes a ` verify ` argument so that it does not need to be configured on the
7685` Client ` instance after it's been constructed nor on every request:
7786
78- from marklogic.client import Client
87+ from marklogic import Client
7988 client = Client('https://localhost:8030', digest=('username', 'password'), verify='/path/to/cert.pem')
8089
8190When specifying the base URL via separate arguments, the ` scheme ` argument can be set for HTTPS connections:
8291
83- from marklogic.client import Client
92+ from marklogic import Client
8493 client = Client(host='localhost', port='8030', scheme='https', digest=('username', 'password'), verify=False)
0 commit comments