Skip to content

Commit 319ad72

Browse files
committed
Few more docs fixes
1 parent 0a88cbd commit 319ad72

File tree

4 files changed

+32
-11
lines changed

4 files changed

+32
-11
lines changed

docs/creating-client.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ response = client.post('/v1/search')
3535
response = client.get('/v1/documents', params={'uri': '/my-doc.json'})
3636
```
3737

38-
Because the `Client` class extends the `Sessions` class, it can be used as a context manager:
38+
Because the `Client` class extends the `Session` class, it can be used as a context manager:
3939

4040
```
4141
with Client('http://localhost:8000', digest=('python-user', 'pyth0n')) as client:

docs/managing-documents/reading.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,19 @@ docs = client.documents.read(uris, categories=["collections"])
8989
print(docs)
9090
```
9191

92-
# Error handling
92+
## Providing additional arguments
9393

94-
A GET call to the /v1/documents endpoint in MarkLogic will return an HTTP response with a status code of 200 for a
95-
successful request. For any other status code, the `client.documents.read` method will the `requests` `Response` object,
96-
providing access to the error details returned by MarkLogic.
94+
The `client.documents.read` method provides a `**kwargs` argument, so you can pass in any other arguments you would
95+
normally pass to `requests`. For example:
96+
97+
```
98+
uris = ["/doc1.json", "/doc2.xml", "/doc3.bin"]
99+
docs = client.documents.read(uris, params={"database": "Documents"})
100+
assert len(docs) == 2
101+
```
102+
103+
## Error handling
104+
105+
If the `client.documents.read` method receives an HTTP response with a status code of 200, then the client will return
106+
a list of `Document` instances. For any other status code, the client will return the `requests` `Response` object,
107+
providing access to the error details returned by the MarkLogic REST API.

docs/managing-documents/searching.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ permalink: /documents/searching
88

99
The [POST /v1/search endpoint](https://docs.marklogic.com/REST/POST/v1/search) in the MarkLogic REST API supports
1010
returning content and metadata for each matching document. Similar to reading multiple documents via the
11-
[GET /v1/documents endpoint](https://docs.marklogic.com/REST/GET/v1/documents, the data is returned in a multipart
11+
[GET /v1/documents endpoint](https://docs.marklogic.com/REST/GET/v1/documents), the data is returned in a multipart
1212
HTTP response. The MarkLogic Python client simplifies use of this operation by returning a list of `Document` instances
1313
via the `client.documents.search` method.
1414

@@ -139,9 +139,10 @@ assert docs[0].content is None
139139
assert docs[1].content is None
140140
```
141141

142-
The `client.documents.search` method provides a `**kwargs` argument, so you can pass in any other arguments you would
143-
normally pass to `requests`, such as a `params` argument that specifies additional parameters:
142+
## Providing additional arguments
144143

144+
The `client.documents.search` method provides a `**kwargs` argument, so you can pass in any other arguments you would
145+
normally pass to `requests`. For example:
145146

146147
```
147148
docs = client.documents.search("example", params={"database": "Documents"})
@@ -150,6 +151,6 @@ assert len(docs) == 2
150151

151152
## Error handling
152153

153-
A POST call to the /v1/search endpoint in MarkLogic will return an HTTP response with a status code of 200 for a
154-
successful request. For any other status code, the `client.documents.search` method will the `requests` `Response` object,
155-
providing access to the error details returned by MarkLogic.
154+
If the `client.documents.read` method receives an HTTP response with a status code of 200, then the client will return
155+
a list of `Document` instances. For any other status code, the client will return the `requests` `Response` object,
156+
providing access to the error details returned by the MarkLogic REST API.

docs/managing-documents/writing.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,15 @@ construct the URI:
138138
client.documents.write([Document(None, {"doc": 1}, extension=".json", directory="/example/")])
139139
```
140140

141+
## Providing additional arguments
142+
143+
The `client.documents.write` method provides a `**kwargs` argument, so you can pass in any other arguments you would
144+
normally pass to `requests`. For example:
145+
146+
```
147+
response = client.documents.write(Document("/doc1.json", {"doc": 1}, permissions=default_perms), params={"database": "Documents"})
148+
```
149+
141150
## Error handling
142151

143152
Because the `client.documents.write` method returns a `requests Response` object, any error that occurs during

0 commit comments

Comments
 (0)