Skip to content

Commit ac99712

Browse files
authored
Merge pull request #54 from Flimm/fix-rst-again
Fix RST again
2 parents 2979478 + 9d2c5fa commit ac99712

File tree

3 files changed

+33
-22
lines changed

3 files changed

+33
-22
lines changed

README.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Source is available on
1414

1515
You'll need to run `python virtualenv`.
1616
Then
17-
```commandline
17+
18+
```
1819
bin/pip install -r requirements.txt
1920
bin/python setup.py develop
2021
```
@@ -29,6 +30,7 @@ object. This object has a .toJSON() method that will return a JSON object that c
2930
and push data.
3031

3132
As illustration, a `subscription_info` object may look like:
33+
3234
```json
3335
{"endpoint": "https://updates.push.services.mozilla.com/push/v1/gAA...", "keys": {"auth": "k8J...", "p256dh": "BOr..."}}
3436
```
@@ -44,14 +46,15 @@ In many cases, your code will be sending a single message to many
4446
recipients. There's a "One Call" function which will make things
4547
easier.
4648

47-
```pythonstub
48-
from pywebpush import webpush
49+
```python
50+
from pywebpush import webpush
4951

50-
webpush(subscription_info,
51-
data,
52-
vapid_private_key="Private Key or File Path[1]",
53-
vapid_claims={"sub": "mailto:YourEmailAddress"})
52+
webpush(subscription_info,
53+
data,
54+
vapid_private_key="Private Key or File Path[1]",
55+
vapid_claims={"sub": "mailto:YourEmailAddress"})
5456
```
57+
5558
This will encode `data`, add the appropriate VAPID auth headers if required and send it to the push server identified
5659
in the `subscription_info` block.
5760

@@ -74,13 +77,14 @@ pywebpush will attempt to auto-fill from the `endpoint`.
7477
a base64 encoded DER formatted private key, or the path to an OpenSSL exported private key file.
7578

7679
e.g. the output of:
77-
```commandline
80+
81+
```
7882
openssl ecparam -name prime256v1 -genkey -noout -out private_key.pem
7983
```
8084

8185
**Example**
8286

83-
```pythonstub
87+
```python
8488
from pywebpush import webpush, WebPushException
8589

8690
try:
@@ -133,7 +137,8 @@ named `encrpypted.data`. This command is meant to be used for debugging purposes
133137
**Example**
134138

135139
to send from Chrome using the old GCM mode:
136-
```pythonstub
140+
141+
```python
137142
WebPusher(subscription_info).send(data, headers, ttl, gcm_key)
138143
```
139144

@@ -149,7 +154,7 @@ Encode the `data` for future use. On error, returns a `WebPushException`
149154

150155
**Example**
151156

152-
```pythonstub
157+
```python
153158
encoded_data = WebPush(subscription_info).encode(data)
154159
```
155160

README.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Installation
1212

1313
You'll need to run ``python virtualenv``. Then
1414

15-
.. code:: commandline
15+
::
1616

1717
bin/pip install -r requirements.txt
1818
bin/python setup.py develop
@@ -43,14 +43,14 @@ Sending Data using ``webpush()`` One Call
4343
In many cases, your code will be sending a single message to many
4444
recipients. There's a "One Call" function which will make things easier.
4545

46-
.. code:: pythonstub
46+
.. code:: python
4747
48-
from pywebpush import webpush
48+
from pywebpush import webpush
4949
50-
webpush(subscription_info,
51-
data,
52-
vapid_private_key="Private Key or File Path[1]",
53-
vapid_claims={"sub": "mailto:YourEmailAddress"})
50+
webpush(subscription_info,
51+
data,
52+
vapid_private_key="Private Key or File Path[1]",
53+
vapid_claims={"sub": "mailto:YourEmailAddress"})
5454
5555
This will encode ``data``, add the appropriate VAPID auth headers if
5656
required and send it to the push server identified in the
@@ -84,13 +84,13 @@ file.
8484

8585
e.g. the output of:
8686

87-
.. code:: commandline
87+
::
8888

8989
openssl ecparam -name prime256v1 -genkey -noout -out private_key.pem
9090

9191
**Example**
9292

93-
.. code:: pythonstub
93+
.. code:: python
9494
9595
from pywebpush import webpush, WebPushException
9696
@@ -153,7 +153,7 @@ purposes.
153153

154154
to send from Chrome using the old GCM mode:
155155

156-
.. code:: pythonstub
156+
.. code:: python
157157
158158
WebPusher(subscription_info).send(data, headers, ttl, gcm_key)
159159
@@ -171,7 +171,7 @@ Encode the ``data`` for future use. On error, returns a
171171

172172
**Example**
173173

174-
.. code:: pythonstub
174+
.. code:: python
175175
176176
encoded_data = WebPush(subscription_info).encode(data)
177177

convert_readme.sh

100644100755
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1+
#!/bin/sh
2+
3+
# You will need pandoc to be installed for this to work correctly, as well as the PyPI packages docutils and pygments
4+
5+
set -e
16
pandoc --from=markdown --to=rst --output README.rst README.md
7+
python setup.py check --restructuredtext --strict --metadata

0 commit comments

Comments
 (0)