Skip to content

Commit fe9ead3

Browse files
author
l00282963
committed
update readme
APPx: Feature or Bugfix:
1 parent 05ed014 commit fe9ead3

File tree

1 file changed

+47
-63
lines changed

1 file changed

+47
-63
lines changed

README.md

+47-63
Original file line numberDiff line numberDiff line change
@@ -7,101 +7,85 @@
77
* [Installation](#installation)
88
* [Configuration ](#configuration )
99
* [Supported Environments](#supported-environments)
10-
* [Sample Code](# Sample Code)
10+
* [Sample Code](#sample-code)
1111
* [License](#license)
1212

1313

1414
## Introduction
1515

16-
Python sample code encapsulates APIs of the HUAWEI Push Kit server. It provides many sample programs about quick access
17-
to HUAWEI Push Kit for your reference or usage.
16+
Python sample code encapsulates APIs of the HUAWEI Push Kit server. It provides many sample programs about quick access to HUAWEI Push Kit for your reference or usage.
1817

19-
The following table describes packages of Python sample code.
18+
The following table describes packages of Python sample code.
2019

21-
-------------------------------------------------------------------------------------
22-
Package | Description
23-
---------- | ------------------------------------------------------------------
24-
examples | Sample code packages. Each package can run independently.
25-
---------- | ------------------------------------------------------------------
26-
push_admin | Package where APIs of the HUAWEI Push Kit server are encapsulated.
27-
-------------------------------------------------------------------------------------
20+
| Package | Description |
21+
| ---------- | ------------|
22+
| examples | Sample code packages. Each package can run independently.|
23+
| push_admin | Package where APIs of the HUAWEI Push Kit server are encapsulated.|
2824

2925
## Installation
3026

31-
To install pushkit-python-sample, you should extract the compressed ZIP file, execute the following command in the unzipped
32-
directory:
33-
```
34-
python setup.py install
35-
```
27+
To install pushkit-python-sample, you should extract the compressed ZIP file, execute the following command in the unzipped directory:
28+
```
29+
python setup.py install
30+
```
3631

3732
## Supported Environments
38-
For pushkit-python-sample, We currently support Python 2.7 and JetBrains PyCharm are recommended.
33+
For pushkit-python-sample, We currently support Python 2.7 and JetBrains PyCharm are recommended.
3934

4035

4136
## Configuration
42-
The following table describes parameters of the initialize_app method.
37+
The following table describes parameters of the initialize_app method.
4338

44-
--------------------------------------------------------------------------------------------
45-
Parameter | Description
46-
------------- | -------------------------------------------------------------------------
47-
appid | App ID, which is obtained from app information.
48-
------------- | -------------------------------------------------------------------------
49-
appsecret | Secret access key of an app, which is obtained from app information.
50-
------------- | -------------------------------------------------------------------------
51-
token_server | URL for the Huawei OAuth 2.0 service to obtain a token, please refer to Generating an App-Level Access Token.
52-
------------- | --------------------------------------------------------------------------
53-
push_open_url | URL for accessing HUAWEI Push Kit, please refer to Sending Messages.
54-
---------------------------------------------------------------------------------------------
39+
| Parameter | Description |
40+
| ------------- | ------------------------------------------------------------------------- |
41+
| appid | App ID, which is obtained from app information. |
42+
| appsecret | Secret access key of an app, which is obtained from app information. |
43+
| token_server | URL for the Huawei OAuth 2.0 service to obtain a token, please refer to [Generating an App-Level Access Token](https://developer.huawei.com/consumer/en/doc/development/parts-Guides/generating_app_level_access_token). |
44+
| push_open_url | URL for accessing HUAWEI Push Kit, please refer to [Sending Messages](https://developer.huawei.com/consumer/en/doc/development/HMS-References/push-sendapi).||
5545

5646

5747
## Sample Code
58-
Download Python sample code in Downloading Server Sample Code.
48+
Download Python sample code in Downloading Server Sample Code.
5949

6050

61-
Python sample code uses the Messaging structure in the push_admin package as the entry. Each method in the Messaging
62-
structure calls an API of the HUAWEI Push Kit server.
51+
Python sample code uses the Messaging structure in the push_admin package as the entry. Each method in the Messaging
52+
structure calls an API of the HUAWEI Push Kit server.
6353

64-
The following table describes methods in the Messaging structure.
54+
The following table describes methods in the Messaging structure.
6555

66-
-----------------------------------------------------------------------------
67-
Method | Description
68-
----------------- | ---------------------------------------------------
69-
send_message | Sends a message to a device.
70-
----------------- | ---------------------------------------------------
71-
subscribe_topic | Subscribes to a topic.
72-
----------------- | ---------------------------------------------------
73-
unsubscribe_topic | Unsubscribes from a topic.
74-
----------------- | ---------------------------------------------------
75-
list_topics | Queries the list of topics subscribed by a device.
76-
----------------- | ---------------------------------------------------
77-
initialize_app | Initializes the configuration parameters.
78-
-----------------------------------------------------------------------------
56+
| Method | Description
57+
| ----------------- | --------------------------------------------------- |
58+
| send_message | Sends a message to a device. |
59+
| subscribe_topic | Subscribes to a topic. |
60+
| unsubscribe_topic | Unsubscribes from a topic. |
61+
| list_topics | Queries the list of topics subscribed by a device. |
62+
| initialize_app | Initializes the configuration parameters. |
7963

8064

81-
1) Send an Android data message.
82-
Code location: examples/send_data_message.py
65+
1) Send an Android data message.
66+
Code location: examples/send_data_message.py
8367

84-
2) Send an Android notification message.
85-
Code location: examples/send_notify_message.py
68+
2) Send an Android notification message.
69+
Code location: examples/send_notify_message.py
8670

87-
3) Send a message by topic.
88-
Code location: examples/send_topic_message.py
71+
3) Send a message by topic.
72+
Code location: examples/send_topic_message.py
8973

90-
4) Send a message by conditions.
91-
Code location: examples/send_condition_message.py
74+
4) Send a message by conditions.
75+
Code location: examples/send_condition_message.py
9276

93-
5) Send a message to a Huawei quick app.
94-
Code location: examples/send_instance_app_message.py
77+
5) Send a message to a Huawei quick app.
78+
Code location: examples/send_instance_app_message.py
9579

96-
6) Send a message through the WebPush agent.
97-
Code location: examples/send_webpush_message.py
80+
6) Send a message through the WebPush agent.
81+
Code location: examples/send_webpush_message.py
9882

99-
7) Send a message through the APNs agent.
100-
Code location: examples/send_apns_message.py
83+
7) Send a message through the APNs agent.
84+
Code location: examples/send_apns_message.py
10185

102-
8) Send a test message.
103-
Code location: examples/send_test_message.py
86+
8) Send a test message.
87+
Code location: examples/send_test_message.py
10488

10589
## License
10690

107-
pushkit Python sample is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
91+
pushkit Python sample is licensed under the [Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

0 commit comments

Comments
 (0)