Wow!
I strongly suggest you to put this as a leo tip on leo blog ;-)

On Thu, May 2, 2013 at 8:41 AM, Matt Wilkie <[email protected]> wrote:

> wow.
> Leo, python, and Github are frickin amazing.
>
> This leo script, when used as a buttton, will publish the currently
> selected node to Github as a Gist.
>
> Requires the "requests" module. Run from leo from python.exe in order to
> see the console messages.
>
> Here's the result: https://gist.github.com/anonymous/5499428
>
> I can't hardly believe it.
>
>
> {{{
> <?xml version="1.0" encoding="utf-8"?>
> <!-- Created by Leo (http://webpages.charter.net/edreamleo/front.html) -->
> <?xml-stylesheet ekr_test?>
> <leo_file xmlns:leo="http://www.leo-editor.org/2011/leo"; >
> <leo_header file_format="2"/>
> <vnodes>
> <v t="maphew.20130501143027.8319"><vh>push_to_Gist.txt</vh></v>
> </vnodes>
> <tnodes>
> <t tx="maphew.20130501143027.8319">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)
> </t>
> </tnodes>
> </leo_file>
> }}}
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "leo-editor" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/leo-editor?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>



-- 
--
Sincerely,

HaveF

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to