Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jpush-api-python-client
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
jpush-api-python-client
Commits
0e0198dd
Commit
0e0198dd
authored
May 20, 2016
by
fendouai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tests in python3
parent
ca2cb59a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
35 deletions
+12
-35
README.rst
README.rst
+3
-26
test_audience.py
tests/push/test_audience.py
+3
-3
test_message.py
tests/push/test_message.py
+3
-3
test_report.py
tests/report/test_report.py
+1
-1
test_schedule.py
tests/schedule/test_schedule.py
+2
-2
No files found.
README.rst
View file @
0e0198dd
.. image:: https://travis-ci.org/jpush/jpush-api-python-client.svg?branch=master
:target: https://travis-ci.org/jpush/jpush-api-python-client
.. image:: https://badge.fury.io/gh/jpush%2Fjpush-api-python-client.svg
:target: http://badge.fury.io/gh/jpush%2Fjpush-api-python-client
.. image:: https://badge.fury.io/py/jpush.svg
:target: http://badge.fury.io/py/jpush
.. image:: https://pypip.in/download/jpush/badge.svg
:target: https://pypi.python.org/pypi/jpush/
:alt: Downloads
=======================
=======================
JPush API Python Client
JPush API Python Client
=======================
=======================
JPush's officially supported Python client library for accessing JPush APIs.
JPush's officially supported Python client library for accessing JPush APIs.
JPush Rest API Documents:
`http://docs.jpush.io/server/rest_api_v3_push/ <http://docs.jpush.io/server/rest_api_v3_push/>`_
JPush Rest API Documents:
http://docs.jpush.io/server/rest_api_v3_push/
You can download the latest release file here:
`Releases <https://github.com/jpush/jpush-api-python-client/releases>`_
You can download the latest release file here:
https://github.com/jpush/jpush-api-python-client/releases
------------
------------
Installation
Installation
------------
------------
To install jpush-api-python-client, simply:
To install jpush-api-python-client, simply:
.. code-block:: sh
$ sudo pip install jpush
$ sudo pip install jpush
or alternatively install via easy_install:
or alternatively install via easy_install:
.. code-block:: sh
$ sudo easy_install jpush
$ sudo easy_install jpush
or from source:
or from source:
.. code-block:: sh
$ sudo python setup.py install
$ sudo python setup.py install
-------
-------
...
@@ -48,14 +32,12 @@ with Python.
...
@@ -48,14 +32,12 @@ with Python.
To run jpush-api-python-client tests, simply:
To run jpush-api-python-client tests, simply:
.. code-block:: sh
$ nosetests tests/push tests/devices --verbosity=2
$ nosetests tests/push tests/devices --verbosity=2
--------
--------
Examples
Examples
--------
--------
You can see more examples in
`examples <https://github.com/jpush/jpush-api-python-client/blob/master/examples>`_
You can see more examples in
https://github.com/jpush/jpush-api-python-client/blob/master/examples
Simple iOS Push
Simple iOS Push
---------------
---------------
...
@@ -85,8 +67,3 @@ Questions
...
@@ -85,8 +67,3 @@ Questions
--------
--------
The best place to ask questions is our community site:
The best place to ask questions is our community site:
http://community.jpush.cn/
http://community.jpush.cn/
--------
Thanks to
--------
`crystal-wei <https://github.com/crystal-wei>`_ for reporting the jpush-api-python-client issues;
tests/push/test_audience.py
View file @
0e0198dd
...
@@ -30,13 +30,13 @@ class TestAudience(unittest.TestCase):
...
@@ -30,13 +30,13 @@ class TestAudience(unittest.TestCase):
response
=
push
.
send
()
response
=
push
.
send
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
except
common
.
Unauthorized
,
e
:
except
common
.
Unauthorized
as
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
Unauthorized
))
self
.
assertFalse
(
isinstance
(
e
,
common
.
Unauthorized
))
raise
common
.
Unauthorized
(
"Unauthorized"
)
raise
common
.
Unauthorized
(
"Unauthorized"
)
except
common
.
APIConnectionException
,
e
:
except
common
.
APIConnectionException
as
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
APIConnectionException
))
self
.
assertFalse
(
isinstance
(
e
,
common
.
APIConnectionException
))
raise
common
.
APIConnectionException
(
"conn"
)
raise
common
.
APIConnectionException
(
"conn"
)
except
common
.
JPushFailure
,
e
:
except
common
.
JPushFailure
as
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
JPushFailure
))
self
.
assertFalse
(
isinstance
(
e
,
common
.
JPushFailure
))
print
(
"JPushFailure"
)
print
(
"JPushFailure"
)
except
:
except
:
...
...
tests/push/test_message.py
View file @
0e0198dd
...
@@ -43,13 +43,13 @@ class TestMessage(unittest.TestCase):
...
@@ -43,13 +43,13 @@ class TestMessage(unittest.TestCase):
try
:
try
:
response
=
push
.
send
()
response
=
push
.
send
()
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
response
.
status_code
,
200
)
except
common
.
Unauthorized
,
e
:
except
common
.
Unauthorized
as
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
Unauthorized
))
self
.
assertFalse
(
isinstance
(
e
,
common
.
Unauthorized
))
raise
common
.
Unauthorized
(
"Unauthorized"
)
raise
common
.
Unauthorized
(
"Unauthorized"
)
except
common
.
APIConnectionException
,
e
:
except
common
.
APIConnectionException
as
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
APIConnectionException
))
self
.
assertFalse
(
isinstance
(
e
,
common
.
APIConnectionException
))
raise
common
.
APIConnectionException
(
"conn"
)
raise
common
.
APIConnectionException
(
"conn"
)
except
common
.
JPushFailure
,
e
:
except
common
.
JPushFailure
as
e
:
self
.
assertFalse
(
isinstance
(
e
,
common
.
JPushFailure
))
self
.
assertFalse
(
isinstance
(
e
,
common
.
JPushFailure
))
print
(
"JPushFailure"
)
print
(
"JPushFailure"
)
except
:
except
:
...
...
tests/report/test_report.py
View file @
0e0198dd
...
@@ -23,6 +23,6 @@ class TestEntity(unittest.TestCase):
...
@@ -23,6 +23,6 @@ class TestEntity(unittest.TestCase):
try
:
try
:
result
=
report
.
get_users
(
"DAY"
,
"2016-04-10"
,
"3"
)
result
=
report
.
get_users
(
"DAY"
,
"2016-04-10"
,
"3"
)
self
.
assertEqual
(
result
.
status_code
,
200
)
self
.
assertEqual
(
result
.
status_code
,
200
)
except
common
.
JPushFailure
,
e
:
except
common
.
JPushFailure
as
e
:
self
.
assertIsInstance
(
e
,
common
.
JPushFailure
)
self
.
assertIsInstance
(
e
,
common
.
JPushFailure
)
tests/schedule/test_schedule.py
View file @
0e0198dd
...
@@ -37,7 +37,7 @@ class TestEntity(unittest.TestCase):
...
@@ -37,7 +37,7 @@ class TestEntity(unittest.TestCase):
try
:
try
:
result
=
schedule
.
get_schedule_by_id
(
"3fc6e2fa-15a6-11e6-83d4-0021f653c222"
)
result
=
schedule
.
get_schedule_by_id
(
"3fc6e2fa-15a6-11e6-83d4-0021f653c222"
)
self
.
assertNotEqual
(
result
.
status_code
,
200
)
self
.
assertNotEqual
(
result
.
status_code
,
200
)
except
common
.
JPushFailure
,
e
:
except
common
.
JPushFailure
as
e
:
self
.
assertIsInstance
(
e
,
common
.
JPushFailure
)
self
.
assertIsInstance
(
e
,
common
.
JPushFailure
)
def
test_get_schedule_list
(
self
):
def
test_get_schedule_list
(
self
):
...
@@ -69,6 +69,6 @@ class TestEntity(unittest.TestCase):
...
@@ -69,6 +69,6 @@ class TestEntity(unittest.TestCase):
try
:
try
:
result
=
schedule
.
delete_schedule
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
result
=
schedule
.
delete_schedule
(
"e9c553d0-0850-11e6-b6d4-0021f652c102"
)
self
.
assertNotEqual
(
result
.
status_code
,
200
)
self
.
assertNotEqual
(
result
.
status_code
,
200
)
except
common
.
JPushFailure
,
e
:
except
common
.
JPushFailure
as
e
:
self
.
assertIsInstance
(
e
,
common
.
JPushFailure
)
self
.
assertIsInstance
(
e
,
common
.
JPushFailure
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment