You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# OpenPAYGOToken - Python Lib
1
+
# OpenPAYGO - Python Lib
2
2
3
3
This repository contains the Python library for using implementing the different OpenPAYGOToken Suite technologies on your server (for generating tokens and decoding openpaygo metrics payloads) or device (for decoding tokens and making openpaygo metrics payloads).
4
4
@@ -30,7 +30,9 @@ This open-source project was sponsored by:
30
30
31
31
You can install the library by running `pip install openpaygo` or adding `openpaygo` in your requirements.txt file and running `pip install -r requirements.txt`.
32
32
33
-
## Getting Started - Generating Tokens
33
+
## Getting Started - OpenPAYGO Token
34
+
35
+
### Generating Tokens
34
36
35
37
You can use the `generate_token()` function to generate an OpenPAYGOToken Token. The function takes the following parameters, and they should match the configuration in the hardware of the device:
36
38
@@ -48,7 +50,7 @@ The function returns the `updated_count` as a number as well as the `token` as a
48
50
49
51
**Example 1 - Add 7 days:**
50
52
51
-
```
53
+
```python
52
54
from openpaygo import generate_token
53
55
from myexampleproject import device_getter
54
56
@@ -68,7 +70,7 @@ device.save() # We save the new count that we set for the device
68
70
69
71
**Example 2 - Disable PAYG (unlock forever):**
70
72
71
-
```
73
+
```python
72
74
from openpaygo import generate_token, TokenType
73
75
74
76
...
@@ -85,7 +87,7 @@ device.save() # We save the new count that we set for the device
85
87
```
86
88
87
89
88
-
##Getting Started - Decoding a Token
90
+
### Decoding Tokens
89
91
90
92
You can use the `decode_token()` function to generate an OpenPAYGOToken Token. The function takes the following parameters, and they should match the configuration in the hardware of the device:
91
93
@@ -109,7 +111,7 @@ The function will raise a `ValueError` if the key is in the wrong format, but wi
109
111
110
112
**Example:**
111
113
112
-
```
114
+
```python
113
115
from openpaygo import decode_token
114
116
115
117
# We assume the users enters a token and that the device state is saved in my_device_state
0 commit comments