Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: simonwhitaker/PyAPNs
base: 0f2f5d2098
...
head fork: simonwhitaker/PyAPNs
compare: 4f3812b04f
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Commits on Jun 20, 2012
@msabramo msabramo Add a CLI tool called "apns-send" 59ff787
Commits on Oct 22, 2012
Simon Whitaker Merge pull request #9 from msabramo/apns-send-cli-tool
Add a CLI tool called "apns-send"
c9d0878
Simon Whitaker Merge branch 'develop' 4f3812b
Showing with 38 additions and 0 deletions.
  1. +37 −0 apns-send
  2. +1 −0  setup.py
View
37 apns-send
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+from apns import APNs, Payload
+
+import optparse
+
+parser = optparse.OptionParser()
+
+parser.add_option("-c", "--certificate-file",
+ dest="certificate_file",
+ help="Path to .pem certificate file")
+
+parser.add_option("-p", "--push-token",
+ dest="push_token",
+ help="Push token")
+
+parser.add_option("-m", "--message",
+ dest="message",
+ help="Message")
+
+options, args = parser.parse_args()
+
+if options.certificate_file is None:
+ parser.error('Must provide --certificate-file')
+
+if options.push_token is None:
+ parser.error('Must provide --push-token')
+
+if options.message is None:
+ parser.error('Must provide --message')
+
+apns = APNs(cert_file=options.certificate_file)
+
+# Send a notification
+payload = Payload(alert=options.message, sound="default", badge=1)
+apns.gateway_server.send_notification(options.push_token, payload)
+print("Sent push message to APNS gateway.")
View
1  setup.py
@@ -8,6 +8,7 @@
license = 'unlicense.org',
name = 'apns',
py_modules = ['apns'],
+ scripts = ['apns-send'],
url = 'http://www.goosoftware.co.uk/',
version = '1.1.2',
)

No commit comments for this range

Something went wrong with that request. Please try again.