Skip to content

Commit

Permalink
Merge pull request #101 from olucurious/develop
Browse files Browse the repository at this point in the history
- fixed proxy issue and web service workers issue
  • Loading branch information
olucurious committed Dec 18, 2016
2 parents 5586fa7 + 53561a1 commit 008005f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyfcm/__meta__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__summary__ = 'Python client for FCM - Firebase Cloud Messaging (Android & iOS)..'
__url__ = 'https://github.com/olucurious/pyfcm'

__version__ = '1.2.0.1'
__version__ = '1.2.1'

__install_requires__ = ['requests']

Expand Down
9 changes: 6 additions & 3 deletions pyfcm/baseapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def parse_payload(self,
# We have `Do not set this field (to) when sending to multiple topics`
# Which is why it's in the `else` block since `condition` is used when multiple topics are being targeted
if topic_name:
fcm_payload['to'] = '/topics/%s' % (topic_name)
fcm_payload['to'] = '/topics/%s' % topic_name
if low_priority:
fcm_payload['priority'] = self.FCM_LOW_PRIORITY
else:
Expand Down Expand Up @@ -138,7 +138,9 @@ def parse_payload(self,
'icon': message_icon
}
else:
fcm_payload['notification'] = {'icon': message_icon}
fcm_payload['notification'] = {}
if message_icon:
fcm_payload['notification']['icon'] = message_icon
if body_loc_key:
fcm_payload['notification']['body_loc_key'] = body_loc_key
if body_loc_args:
Expand Down Expand Up @@ -173,10 +175,11 @@ def parse_payload(self,
def send_request(self, payloads=None):
self.send_request_responses = []
for payload in payloads:
response = requests.post(self.FCM_END_POINT, headers=self.request_headers(), data=payload)
if self.FCM_REQ_PROXIES:
response = requests.post(self.FCM_END_POINT, headers=self.request_headers(), data=payload,
proxies=self.FCM_REQ_PROXIES)
else:
response = requests.post(self.FCM_END_POINT, headers=self.request_headers(), data=payload)
self.send_request_responses.append(response)

def parse_responses(self):
Expand Down

0 comments on commit 008005f

Please sign in to comment.