autopush.router.apnsrouter
¶
APNS Router
-
class
autopush.router.apnsrouter.
APNSRouter
(conf, router_conf, metrics, load_connections=True)[source]¶ APNS Router Implementation
-
_connect
(rel_channel, load_connections=True)[source]¶ Connect to APNS
Parameters: Returns: APNs to be stored under the proper release channel name.
Return type: apns.APNs
-
__init__
(conf, router_conf, metrics, load_connections=True)[source]¶ Create a new APNS router and connect to APNS
Parameters: - conf (autopush.config.AutopushConfig) – Configuration settings
- router_conf (dict) – Router specific configuration
- load_connections (bool) – (used for testing)
-
register
(uaid, router_data, app_id, *args, **kwargs)[source]¶ Register an endpoint for APNS, on the app_id release channel.
This will validate that an APNs instance token is in the router_data,
Parameters: - uaid – User Agent Identifier
- router_data – Dict containing router specific configuration info
- app_id – The release channel identifier for cert info lookup
-
-
class
autopush.router.apns2.
APNSClient
(cert_file, key_file, topic, alt=False, use_sandbox=False, max_connections=20, logger=None, metrics=None, load_connections=True, max_retry=2)[source]¶ -
__init__
(cert_file, key_file, topic, alt=False, use_sandbox=False, max_connections=20, logger=None, metrics=None, load_connections=True, max_retry=2)[source]¶ Create the APNS client connector.
The cert_file and key_file can be derived from the exported .p12 Apple Push Services: *bundleID* ** key contained in the **Keychain Access application. To extract the proper PEM formatted data, you can use the following commands:
` openssl pkcs12 -in file.p12 -out apns_cert.pem -clcerts -nokeys openssl pkcs12 -in file.p12 -out apns_key.pem -nocerts -nodes `
The topic is the Bundle ID of the bridge recipient iOS application. Since the cert needs to be tied directly to an application, the topic is usually similar to “com.example.MyApplication”.
Parameters: - cert_file (str) – Path to the PEM formatted APNs certification file.
- key_file (str) – Path to the PEM formatted APNs key file.
- topic (str) – The Bundle ID that identifies the assoc. iOS app.
- alt (bool) – Use the alternate APNs publication port (if 443 is blocked)
- use_sandbox (bool) – Use the development sandbox
- max_connections (int) – Max number of pooled connections to use
- logger (logger) – Status logger
- metrics (autopush.metrics.IMetric) – Metric recorder
- load_connections (bool) – used for testing
- max_retry (int) – Number of HTTP2 transmit attempts
-