Skip to content
This repository was archived by the owner on Mar 18, 2019. It is now read-only.

Commit 73fa8a2

Browse files
committed
Updated docs
1 parent 8fd46cb commit 73fa8a2

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ To install, use pip.
2121

2222
### Retrieving and inspecting documents
2323

24-
To initially access a Core API interface, use the `get()` method.
24+
To initially access a Core API interface, use the `get()` function.
2525

2626
>>> import coreapi
2727
>>> doc = coreapi.get('http://coreapi.herokuapp.com')
@@ -60,22 +60,26 @@ You can also inspect the document URL and title.
6060

6161
### Interacting with documents
6262

63-
Documents in the Python Core API library are immutable objects. To perform a transition we call the `.action()` method and assign the resulting new document.
63+
Documents in the Python Core API library are immutable objects. To perform a transition we use the `.action()` function and assign the resulting new document.
6464

65-
>>> doc = doc.action(['add_note'], description='My new note.')
65+
>>> doc = coreapi.action(doc, ['add_note'], description='My new note.')
6666

67-
The first argument to `.action()` is a list of strings or integers, indexing the link to act on. Any extra keyword arguments are passed as parameters to the link.
67+
The arguments to `.action()` are:
6868

69-
Transitions may update of the document tree.
69+
* The existing document.
70+
* A string or list of strings or integers, indexing the link to act on.
71+
* Any parameters to use when the acting on the link.
7072

71-
>>> doc = doc.action(['notes', 0, 'edit'], complete=True)
73+
Transitions may update part of the document tree.
74+
75+
>>> doc = coreapi.action(doc, ['notes', 0, 'edit'], complete=True)
7276
>>> doc['notes'][0]['complete']
7377
True
7478

7579
Or they may remove part of the document tree.
7680

7781
>>> while doc['notes']:
78-
>>> doc = doc.action(['notes', 0, 'delete'])
82+
>>> doc = coreapi.action(doc, ['notes', 0, 'delete'])
7983
>>> len(doc['notes'])
8084
0
8185

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy