Revisions
-
maphew renamed this gist
May 2, 2013 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
maphew revised this gist
May 2, 2013 . 1 changed file with 15 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,8 @@ content = p.b # node body api_url = 'https://api.github.com/gists' user = '' # todo: derive from... parent node? leoID? password = '' # todo: derive from... ??? g.es(filename) @@ -24,9 +24,19 @@ payload = { } #print (payload) #r = requests.post(api_url, data=json.dumps(payload), auth=(user, password)) r = requests.post(api_url, data=json.dumps(payload)) print (r.status_code) #print (r.text) # capture and save request results p = c.p nd = p.insertAsLastChild() nd.h = 'Push result: text' nd.b = r.text c.redraw() #todo: parse text result and return clickable urls # c.createLastChildNode(p.h, 'testing...', r.text) -
maphew revised this gist
May 2, 2013 . 2 changed files with 32 additions and 24 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ import requests import json description = "published from Leo" # todo: derive from docstring, if present, otherwise 1st para public = True filename = p.h # node headline content = p.b # node body api_url = 'https://api.github.com/gists' user = 'anonymous' # todo: derive from... parent node? leoID? password = '' # todo: derive from... tricky one. ssh key I 'spose g.es(filename) print('\n\n--- %s ---' % filename) payload = { 'description': description, 'public': public, 'files': { filename: {'content': content} } } #print (payload) r = requests.post(api_url, data=json.dumps(payload), auth=(user, password)) print (r.status_code) print (r.text) #todo: capture in Leo for re-use later c.createLastChildNode(self, parent, head, r.text) # broken This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,24 +0,0 @@ -
There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ import requests import json tmp = g.os.environ['TEMP'] description = "published from Leo" public = True filename = p.h # node headline content = p.b # node body g.es(filename) print('\n\n--- %s ---' % filename) payload = { 'description': description, 'public': public, 'files': { filename: {'content': content} } } print (payload) r = requests.post('https://api.github.com/gists', data=json.dumps(payload)) print (r.status_code) print (r.text)