44# License: http://jkeyes.mit-license.org/
55#
66
7- from intercom import User
8- from intercom import Intercom
9- from intercom import Impression
10- from intercom import MessageThread
11- #from intercom import Message
12-
137import os
148
159from os import environ as ENV
@@ -27,111 +21,3 @@ def request(*args, **kwargs):
2721 response .content = open (fixture_path ).read ()
2822 return response
2923 return request
30-
31- # Intercom.app_id = ENV['INTERCOM_APP_ID']
32- # Intercom.api_key = ENV['INTERCOM_API_KEY']
33-
34- if __name__ == "__main__" :
35- import logging
36- logging .getLogger ().setLevel (logging .DEBUG )
37-
38- u = User .find_by_email ('johnkeyes+2@gmail.com' ) #(email='newemail2@example.com', custom_data={'age': 42})
39- print u .created_at
40- u .custom_data ['blah' ] = 'john'
41- u .custom_data ['foo' ] = 'tom'
42- u .save ()
43-
44- # print u.email, u.custom_data
45-
46- # users = User.all()
47- # print len(users)
48- # for u in users:
49- # print type(u)
50- # print "-"*90
51- # print u
52- # print "+"*90
53- # print u.email
54- # print u.created_at
55-
56- # from datetime import datetime
57- # u.created_at = datetime.now()
58- # print u.created_at
59- # u.save()
60-
61- # u = User.get(email='john+7@samplc.com')
62- # print u.created_at
63-
64- # # print User.get(email='newemail2@example.com')
65-
66- # msg = MessageThread.create(email='newemail2@example.com', body="Bobby Bobby")
67- # impression = Impression.create(email='newemail2@example.com', user_ip='72.37.242.27',
68- # user_agent='Boozilla/10.1')
69- # print "+++++++>>>>", impression
70- # print impression.location
71-
72- # impression = Impression()
73- # impression.email = 'newemail2@example.com'
74- # impression.user_ip = '209.191.122.70'
75- # impression.save()
76-
77- # # msg = MessageThread.reply(email='newemail2@example.com', body="2 Some more...", thread_id='17847')
78-
79-
80-
81- # threads = MessageThread.find(email='newemail2@example.com') #, read=False, thread_id='17847')
82- # print len(threads)
83- # thread_1 = threads[0]
84- # print thread_1.created_at
85- # print thread_1.updated_at
86- # print len(thread_1.messages)
87- # print thread_1.messages[0].author.name
88-
89-
90- # print ">>"*20
91- # print msg.keys()
92- # print msg.messages
93- # # print type(msg.messages[0])
94- # # print type(msg.messages[0]['from'])
95- # print msg['updated_at']
96- # print msg.updated_at
97- # msg.thread_id = "123"
98- # print msg['thread_id']
99- # print ">>"*20
100-
101- # # message = Message({'from': { 'author': 'John'}})
102- # # print message.author
103-
104- # # threads = MessageThread.find_all(email='newemail2@example.com')
105- # # for th in threads:
106- # # print th
107- # # print threads
108-
109- # # print MessageThread.find(email='newemail2@example.com', thread_id='17847')
110-
111-
112- # #u.name = "Bobby Joe McGovern"
113- # #u.last_seen_user_agent = "Mozilla"
114- # # u.blooper = "Blooper"
115- # #u.save()
116- # #print ">>>", u.created_at
117- # # import time
118-
119-
120- # # inter = Intercom()
121-
122- # # email = 'john+1@example.com'
123-
124- # # # print "create"
125- # # # inter.create_user(email=email, created_at=time.time())
126- # # # print "\n\nupdate"
127- # # #inter.update_user(email=email, custom_data={'age': '42'})
128- # # # print "\n\nget"
129- # # user = inter.get_user(email=email)
130- # # # print "\n\ncreate impression"
131- # # # inter.create_impression(email=email)
132- # # print "\n\nget messages"
133- # # inter.get_message_threads(email=email)
134- # # # print "\n\ncreate message"
135- # # # inter.create_message(email=email, body="Hi John, Python API calling.")
136-
137- # # #inter.get_users()
0 commit comments