Created
October 10, 2013 21:31
-
-
Save ernestom/6925972 to your computer and use it in GitHub Desktop.
Fetch chat messages from gygia.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import base64 | |
import requests | |
API_KEY = 'API_KEY' | |
CHAT_CATEGORY_ID = '56481030' | |
class Gigya(object): | |
def __init__(self, api_key, secret_key): | |
self.api_key = api_key | |
self.secret_key = secret_key | |
def get_oauth_token(self): | |
url = 'https://socialize.gigya.com/socialize.getToken' | |
data = {'grant_type': 'none'} | |
authorization = base64.b64encode('%s:%s' % (self.api_key, self.secret_key)) | |
headers = {'Authorization': 'Basic %s' % authorization} | |
response = requests.post(url, data=data, headers=headers) | |
print response | |
print response.headers | |
print response.json() | |
def get_chat_messages(self): | |
url = 'https://chat.gigya.com/chat.getMessages' | |
data = {'categoryID': CHAT_CATEGORY_ID} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment