Skip to content

Commit ec72b22

Browse files
author
drice
committed
Prepare for release 0.0.6
Update to support Python3 for elements, appsecret_proofw :
1 parent 26b067e commit ec72b22

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

pymessenger.egg-info/PKG-INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
Metadata-Version: 1.1
22
Name: pymessenger
3-
Version: 0.0.3.1
3+
Version: 0.0.6.0
44
Summary: Python Wrapper for FB Messenger Bot
55
Home-page: https://github.com/davidchua/pymessenger
66
Author: David Chua
77
Author-email: [email protected]
88
License: UNKNOWN
9-
Download-URL: https://github.com/davidchua/pymessenger/tarball/0.0.3
9+
Download-URL: https://github.com/davidchua/pymessenger/tarball/0.0.6
1010
Description: UNKNOWN
1111
Keywords: facebook messenger,python,wrapper,bot,messenger bot
1212
Platform: UNKNOWN

pymessenger.egg-info/SOURCES.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ setup.cfg
22
setup.py
33
pymessenger/__init__.py
44
pymessenger/bot.py
5+
pymessenger/graph_api.py
6+
pymessenger/receipt.py
7+
pymessenger/user_profile.py
8+
pymessenger/utils.py
59
pymessenger.egg-info/PKG-INFO
610
pymessenger.egg-info/SOURCES.txt
711
pymessenger.egg-info/dependency_links.txt

pymessenger/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import json
2+
import six
23

34
from .bot import Bot
45

56
class Element(dict):
67
__acceptable_keys = ['title', 'item_url', 'image_url', 'subtitle', 'buttons']
78
def __init__(self, *args, **kwargs):
8-
kwargs = {k:v for k, v in kwargs.iteritems() if k in self.__acceptable_keys}
9+
if six.PY2:
10+
kwargs = {k:v for k, v in kwargs.iteritems() if k in self.__acceptable_keys}
11+
else:
12+
kwargs = {k:v for k, v in kwargs.items() if k in self.__acceptable_keys}
913
super(Element, self).__init__(*args, **kwargs)
1014

1115
def to_json(self):

pymessenger/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import hashlib
22
import hmac
3+
import six
34

45
def validate_hub_signature(app_secret, request_payload, hub_signature_header):
56
'''
@@ -31,6 +32,9 @@ def generate_appsecret_proof(access_token, app_secret):
3132
appsecret_proof: HMAC-SHA256 hash of page access token
3233
using app_secret as the key
3334
'''
34-
hmac_object = hmac.new(str(app_secret), unicode(access_token), hashlib.sha256)
35+
if six.PY2:
36+
hmac_object = hmac.new(str(app_secret), unicode(access_token), hashlib.sha256)
37+
else:
38+
hmac_object = hmac.new(bytearray(app_secret, 'utf8'), str(access_token).encode('utf8'), hashlib.sha256)
3539
generated_hash = hmac_object.hexdigest()
3640
return generated_hash

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pytest
22
requests
33
requests-toolbelt
4+
six

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
setup(
33
name = 'pymessenger',
44
packages = ['pymessenger'],
5-
version = '0.0.5.0',
5+
version = '0.0.6.0',
66
install_requires=[
77
'requests',
8-
'requests-toolbelt'
8+
'requests-toolbelt',
9+
'six'
910
],
1011
description = "Python Wrapper for FB Messenger Bot",
1112
author = 'David Chua',
1213
author_email = '[email protected]',
1314
url = 'https://github.com/davidchua/pymessenger',
14-
download_url = 'https://github.com/davidchua/pymessenger/tarball/0.0.5',
15+
download_url = 'https://github.com/davidchua/pymessenger/tarball/0.0.6',
1516
keywords = ['facebook messenger', 'python', 'wrapper', 'bot', 'messenger bot'],
1617
classifiers = [],
1718
)

0 commit comments

Comments
 (0)