Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#!/usr/bin/env python

from __future__ import division
import pprint, time
import pprint
import time
import webbrowser
import tentapp
from colors import *

def debugJson(s=''): print magenta(pprint.pformat(s))

def debugJson(s=''):
print magenta(pprint.pformat(s))

print yellow('-----------------------------------------------------------------------\\')

Expand Down Expand Up @@ -105,7 +108,7 @@ def debugJson(s=''): print magenta(pprint.pformat(s))

# Post a new status message
if app.hasPermanentKeys():
text = "This is a test message from python-tent-client's example.py. The time is %s"%int(time.time())
text = "This is a test message from python-tent-client's example.py. The time is %s" % int(time.time())
post = {
'type': 'https://tent.io/types/post/status/v0.1.0',
'published_at': int(time.time()),
Expand All @@ -119,8 +122,7 @@ def debugJson(s=''): print magenta(pprint.pformat(s))
}
app.putPost(post)
print yellow('A message has been posted to pythonclienttest.tent.is:')
print cyan(' '+text)
print cyan(' ' + text)


print yellow('-----------------------------------------------------------------------/')

13 changes: 7 additions & 6 deletions example_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
# and print them to the screen.

from __future__ import division
import pprint, time
import pprint
import time
import tentapp
from colors import *

Expand All @@ -20,7 +21,8 @@

# Because we've authenticated, getPosts() will get not only our own public posts
# but also those of people we follow and posts that mention us.
# tent.is limits this to the last 50 posts or so unless additional parameters are present
# tent.is limits this to the last 50 posts or so unless additional
# parameters are present
posts = app.getPosts()

# # By default posts are sorted newest first.
Expand All @@ -29,10 +31,9 @@

for post in posts:
if post['type'] == 'https://tent.io/types/post/status/v0.1.0':
timestamp = time.asctime(time.localtime( post['published_at'] ))
print '%s %s'%(yellow(post['entity']), white(timestamp))
print ' %s'%cyan(post['content']['text'])
timestamp = time.asctime(time.localtime(post['published_at']))
print '%s %s' % (yellow(post['entity']), white(timestamp))
print ' %s' % cyan(post['content']['text'])
print

print yellow('-----------------------------------------------------------------------/')

Loading