Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Cheruiyot committed Nov 29, 2016
2 parents eabf015 + 84661e5 commit e4dd03e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pymessenger/bot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os
from enum import Enum

import logging
import requests
from requests_toolbelt import MultipartEncoder

Expand Down Expand Up @@ -85,8 +86,11 @@ def send_attachment(self, recipient_id, attachment_type, attachment_path,
multipart_header = {
'Content-Type': multipart_data.content_type
}
return requests.post(self.graph_url, data=multipart_data,
params=self.auth_args, headers=multipart_header).json()
response = requests.post(self.graph_url, data=multipart_data,
params=self.auth_args, headers=multipart_header).json()

logging.info(response)
return response

def send_attachment_url(self, recipient_id, attachment_type, attachment_url,
notification_type=NotificationType.regular):
Expand Down Expand Up @@ -285,7 +289,9 @@ def get_user_info(self, recipient_id, fields=None):
request_endpoint = '{0}/{1}'.format(self.graph_url, recipient_id)
response = requests.get(request_endpoint, params=params)
if response.status_code == 200:
return response.json()
result = response.json()
logging.info(result)
return result

return None

Expand All @@ -297,6 +303,7 @@ def send_raw(self, payload):
json=payload
)
result = response.json()
logging.info(result)
return result

def _send_payload(self, payload):
Expand Down

0 comments on commit e4dd03e

Please sign in to comment.