Permalink
Browse files

Make apns work

  • Loading branch information...
1 parent 3ef74a5 commit 81f5c8d7700eddf1b87738bb9c19cfe936d31557 Amyth Singh committed Feb 26, 2016
Showing with 13 additions and 82 deletions.
  1. +6 −0 .gitignore
  2. +2 −4 apps/home/forms.py
  3. +3 −8 apps/home/views.py
  4. +1 −1 config/settings.py
  5. +1 −1 requirements.txt
  6. +0 −68 temp/pushcert.pem
View
@@ -63,3 +63,9 @@ target/
## Swp files
*.swp
+
+## templ
+temp/
+
+## DB
+db.*
View
@@ -18,7 +18,7 @@ def clean_pem_certificate(self):
f = self.cleaned_data.get('pem_certificate')
content = f.readlines()
- tfile = open("temp/%s" % f.name, 'w')
+ tfile = open("/tmp/%s" % f.name, 'w')
tfile.writelines(content)
filename = os.path.abspath(tfile.name)
tfile.close()
@@ -33,9 +33,7 @@ def send_message(self, *args, **kwargs):
json_data = data.get('apns_data')
message_obj = json.loads(json_data) if json_data else {"message": message}
- print pem_cert
-
- return apns.apns_send_bulk_message(ids, message_obj, certfile=pem_cert)
+ return apns.apns_send_bulk_message(ids, message_obj, certfile=os.path.abspath(pem_cert))
class GCMForm(forms.Form):
View
@@ -21,15 +21,10 @@ class APNSTester(FormView):
def form_valid(self, form, *args, **kwargs):
- result = form.send_message()
try:
- result = form.send_message()
- print result
- if result.get('failure'):
- error = result.get('results')[0]['error']
- messages.error(self.request, error)
- elif result.get('success'):
- messages.success(self.request, 'Message(s) sent.')
+ x = form.send_message()
+ print x
+ messages.success(self.request, 'Message(s) sent.')
except Exception as err:
messages.error(self.request, str(err))
View
@@ -25,7 +25,7 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
-ALLOWED_HOSTS = []
+ALLOWED_HOSTS = ["*"]
# Application definition
View
@@ -1,7 +1,7 @@
appnope==0.1.0
decorator==4.0.9
Django==1.9.2
-django-instapush==1.0.1
+django-instapush==1.0.3
gnureadline==6.3.3
ipython==4.1.1
ipython-genutils==0.1.0
View
@@ -1,68 +0,0 @@
-Bag Attributes
- friendlyName: Apple Production IOS Push Services: com.htmedia.employeereferral
- localKeyID: BF 58 E4 72 39 60 A9 E8 A5 BA 1A D1 EB 2A 9E 40 C8 80 31 2B
-subject=/UID=com.htmedia.employeereferral/CN=Apple Production IOS Push Services: com.htmedia.employeereferral/OU=MBS2R82HUY/C=US
-issuer=/C=US/O=Apple Inc./OU=Apple Worldwide Developer Relations/CN=Apple Worldwide Developer Relations Certification Authority
------BEGIN CERTIFICATE-----
-MIIFnDCCBISgAwIBAgIIMzOe5g3GiJcwDQYJKoZIhvcNAQEFBQAwgZYxCzAJBgNV
-BAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3Js
-ZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3
-aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw
-HhcNMTUxMTE5MTAwODI4WhcNMTYxMTE4MTAwODI4WjCBmzEsMCoGCgmSJomT8ixk
-AQEMHGNvbS5odG1lZGlhLmVtcGxveWVlcmVmZXJyYWwxSTBHBgNVBAMMQEFwcGxl
-IFByb2R1Y3Rpb24gSU9TIFB1c2ggU2VydmljZXM6IGNvbS5odG1lZGlhLmVtcGxv
-eWVlcmVmZXJyYWwxEzARBgNVBAsMCk1CUzJSODJIVVkxCzAJBgNVBAYTAlVTMIIB
-IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAroAFMm7xZxviAbob9WyVGcnW
-2QvbDHIeSFsIig/pWvKNtIpUCT/bhmBJka6DkU+Jndeh2txionAJG2mLhUstPCvp
-aV/BqB0LvYklQTczJuB/2xt8QVyCUASbT1HiUFrO/JEvWojdlsQvO8dvUFjbdaBN
-KyZn6GTPUACFVeoqC5bIMfqu4WS+2MyOzLJgBs8v592QcsgziEzsW/X+7xPVnv4F
-HpO6KKsYbR1pINrbzcgOfHvjv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9ZG6ZpaCBqcNVaCcBkygs30/lMg+2xxRnLHwKnOSWp+Hr+JVCBp/bH/
-/uYGSyvIEDOOCwxVLiUqcytnczm58rTHnXw2RVySoa2YKotp1CGxJqE1dgVq2D/e
------END CERTIFICATE-----
-Bag Attributes
- friendlyName: Sumit Jain
- localKeyID: BF 58 E4 72 39 60 A9 E8 A5 BA 1A D1 EB 2A 9E 40 C8 80 31 2B
-Key Attributes: <No Attributes>
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAroAFMm7xZxviAbob9WyVGcnW2QvbDHIeSFsIig/pWvKNtIpU
-CT/bhmBJka6DkU+Jndeh2txionAJG2mLhUstPCvpaV/BqB0LvYklQTczJuB/2xt8
-QVyCUASbT1HiUFrO/JEvWojdlsQvO8dvUFjbdaBNKyZn6GTPUACFVeoqC5bIMfqu
-4WS+2MyOzLJgBs8v592QcsgziEzsW/X+7xPVnv4FHpO6KKsYbR1pINrbzcgOfHvj
-vp01TvnFy6Y6eEUf9wfT5JqXqXHpf9kui6AUX4akaSvEWcPnhgbf/1ULxjIvgRPG
-CyABzZCM2gHhUGKGka/Wx+oZ806wiPvSyVzM9QIDAQABAoIBAQCQ6GDoc7bmEAKL
-upgzI3th0fonfa/m0vGQ1n/t3q7DRr8kWObWU4AiQ910K/638dvvBr0y+WazS+RU
-Lj6db0NeP3zyc4Fm8M/qEnSshoFk3HNwaY+y23afqmOq5+3PGsnedVZkkVmqNLqg
-osouZ8u/D2Jl3dvV4blCz1vqb62AttOZtlkztAyEBcBZAXbcdqM/yUySUeHBDHib
-GadXDMu45aScz7iHGG8luBB8O/t0AYcrNeFrRtYXxtworVK2KX4h/SlHY/neQajD
-1RBy3UI/3cl+CQwOGnEL4vT2sECZTvcvHnQByesSl9VWlBqdjGzjg4CTckDMDq9J
-mZxpbdChAoGBAN1a4CTcCFU1OjBddNnp2J4ss7DCajFPRtdS5kYZEscNT/duaABg
-4JOJMa1h5iLhU3vhGkqr2ylWMtsLucNHC4uuwPupb9g9xAZuyPhgaT6rhwsuRHDj
-2Hm+hTd7gDVd8cSividtL6J/TLm2tOswjC3qUQfhdVpNG1gl0C4zUAEJAoGBAMnP
-yhMibgvoqUoKIr7IAizUofBhUO+rwV+/1a242BPhloIR3BUd5pc+gxqNLo2x5sER
-jCpLvCywbm16UC59x6KrVauJbd3K5c6IJxEFwisUBNKpJ9gdSo9GMkkUT3sVTO6k
-mb7YzcfPSdnL8n7HYCxL3k1XU6fU+oB1YTX26CONAoGAeOH98mMvMclFo9AF1lN8
-drUW1Hr3n0IZ/9FH7BQZSxccCpYCueIuAqQzuunx0i6XdtlxkEHWB/cJAtKeeeQ8
-i+W9gjH/4GmquZCas/mCwDTQJOz5d2UWfTXsbmZFl99b/vSZP9LC5sz6S5lZp+71
-PsXtxo37lnrxaewMio5/LHECgYBdFfgabVYfLhjv6s7t+ult7kIn02t2sV2Hob+Y
-2troCLTYmA5QuzMCbjYgyCBCAV3zjfl+BOLuJg85diKH30J3GNpyPfisRgtMAWcr
-peFS52/2D0oumAwtG+7T4IdsuX170faMngoE8Osah8T5j1Mf+3q1Z+NRVZ6aJApL
-zvByfQKBgGC+fjEOOBzRs6aUY3l0VSMeULrVoczMtwFS+BcXkKewvWES1fhGGlau
-GblsuuT4Gp/l9XWY5VtbX7RzAaT8JXTthOlqu4WJzAqCUdgQFiB+50OarHvsUiht
-E0teGQwzfqOkYtLYXxgBiDcskUzZjepJBjmtRkRWVdGQCj/qrvRa
------END RSA PRIVATE KEY-----

0 comments on commit 81f5c8d

Please sign in to comment.