Skip to content

Commit 8f2e886

Browse files
authored
Merge pull request #5 from openpaygo/update-doc
Updated doc
2 parents 2caa64a + 44a65ca commit 8f2e886

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# OpenPAYGOToken - Python Lib
1+
# OpenPAYGO - Python Lib
22

33
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).
44

@@ -30,7 +30,9 @@ This open-source project was sponsored by:
3030

3131
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`.
3232

33-
## Getting Started - Generating Tokens
33+
## Getting Started - OpenPAYGO Token
34+
35+
### Generating Tokens
3436

3537
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:
3638

@@ -48,7 +50,7 @@ The function returns the `updated_count` as a number as well as the `token` as a
4850

4951
**Example 1 - Add 7 days:**
5052

51-
```
53+
```python
5254
from openpaygo import generate_token
5355
from myexampleproject import device_getter
5456

@@ -68,7 +70,7 @@ device.save() # We save the new count that we set for the device
6870

6971
**Example 2 - Disable PAYG (unlock forever):**
7072

71-
```
73+
```python
7274
from openpaygo import generate_token, TokenType
7375

7476
...
@@ -85,7 +87,7 @@ device.save() # We save the new count that we set for the device
8587
```
8688

8789

88-
## Getting Started - Decoding a Token
90+
### Decoding Tokens
8991

9092
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:
9193

@@ -109,7 +111,7 @@ The function will raise a `ValueError` if the key is in the wrong format, but wi
109111

110112
**Example:**
111113

112-
```
114+
```python
113115
from openpaygo import decode_token
114116

115117
# We assume the users enters a token and that the device state is saved in my_device_state
@@ -136,6 +138,7 @@ elif token_type == TokenType.SET_TIME:
136138
my_device_state.days_remaining = value
137139
print(f'Set to {value} days remaining')
138140
elif token_type == TokenType.DISABLE_PAYG:
141+
print('Unlocked Device')
139142
my_device_state.unlocked_forever = True
140143
elif token_type == TokenType.COUNTER_SYNC:
141144
print('Counter Synced')

0 commit comments

Comments
 (0)