@@ -6,16 +6,14 @@ To use it you will need an http client initializaed with the correction URL and
6
6
7
7
.. code-block :: python
8
8
9
- import rframe
10
9
import xedocs
11
10
12
- datasource = rframe.RestClient( URL , headers = { " Authorization " : f " Bearer: { ACCESS_TOKEN } " } )
11
+ db = xedocs.xedocs_api( )
13
12
14
- gain_docs = xedocs.PmtGains.find(datasource, pmt = 1 , version = ' v3' )
13
+ df = db.posrec_models.find_df( version = ' v3' , run_id = 25000 )
15
14
16
15
17
- to make things a bit easier,
18
- there is a utility function that will create an API client for you `xedocs.get_api_client `
16
+ there is also a utility function that will create an API client for you `xedocs.get_api_client `
19
17
If you dont have a token, it will attempt to use the xeauth package to get one for you (if installed).
20
18
21
19
You can install xeauth by running `pip install xeauth `
@@ -28,11 +26,6 @@ You can install xeauth by running `pip install xeauth`
28
26
29
27
# The script will attempt to open a browser for authentication
30
28
# if the broswer does not open automatically, follow the link printed out.
31
- # Once you are authenticated as a xenon member, a readonly access token will be
32
- # retrieved automatically. If you change xedocs.settings.API_WRITE to True, a token
33
- # with write permissions will be retrieved.
34
-
35
-
36
29
gain_docs = xedocs.PmtGains.find(datasource, pmt = 1 , version = ' v3' )
37
30
38
31
@@ -46,23 +39,9 @@ Example:
46
39
47
40
import xedocs
48
41
49
- doc = xedocs.PmtGains (pmt = 1 , version = ' v3' , value = 1 , ... )
50
- doc.save(datasource )
42
+ doc = xedocs.PmtAreaToPE (pmt = 1 , version = ' v3' , value = 1 , ... )
43
+ db.insert(doc )
51
44
52
45
If all the conditions for insertion are met, e.g. the values for the given index not already being set, the insertion will be successful.
53
46
54
- Of course you must have write access to the datasource for any insertion to succeed. The default datasources are all read-only.
55
- When using the server to write values you must request a token with write permissions:
56
-
57
- .. code-block :: python
58
-
59
- import xedocs
60
-
61
- # If you have to correction roles defined (correction expert), you can request a token with
62
- # extended scope i.e. write:all. This token will allow you to write to all correction collections
63
- # If you do not have the proper permissions, you will just get back the default token scope of read:all
64
- datasource = xedocs.get_api_client(' pmt_gains' )
65
-
66
- doc = xedocs.PmtGains(pmt = 1 , version = ' v3' , value = 1 , ... )
67
- doc.save(datasource)
68
-
47
+ Of course you must have write access to the datasource for any insertion to succeed.
0 commit comments