Home Download Buy Blog Forum Support

Simplenote plugin

Simplenote plugin

Postby SteveCooperOrg on Sat Aug 07, 2010 10:47 pm

Hi, All.

I've put together a plugin for interacting with a SimpleNote account (http://simplenoteapp.com/). Basically, it's an iPhone note-taking app that syncs to the cloud. This plugin allows you to pull down a note from the site, edit in sublime, and when you hit 'save', it'll upload it back to the site. It basically gives you a shared note store between an iPhone and Sublime.

There's a little bit of config. You need to add a file containing your simplenote email address and password in %APPDATA%\simplenote-api-key.txt, with contents like

Code: Select all
username:hektor@troy.com
password:mypassword
working directory:c:\\temp
editor extension: txt


It's available on bitbucket at http://bitbucket.org/stevecooperorg/simplenote/src

Enjoy.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Simplenote plugin

Postby gpfsmurf on Mon Aug 09, 2010 5:28 pm

Nice!
gpfsmurf
 
Posts: 211
Joined: Mon Jun 23, 2008 6:31 pm

Re: Simplenote plugin

Postby ulterior on Fri Aug 13, 2010 11:40 pm

Hi, I'm super keen to get this plugin working, but havent had much luck.

I'm not getting any errors in the console when I load sublime, but the 'List Simplenotes' option under tools is greyed out. I've formatted/located the api-key file correctly...

Are there some OS/python/simplenote account requirements that I'm missing? Perhaps I should try hardcoding my account details, or using the first version from the repository?

Any help would be greatly appreciated :) I am a massive fan of both Sublime and simplenote.

EDIT: seems to be based around python being unable to import the json module, ie:

import json
ImportError: No module named json

Odd though - im runnng python 2.6.4; and running test_json.py comes back positive
ulterior
 
Posts: 3
Joined: Fri Aug 13, 2010 11:25 pm

Re: Simplenote plugin

Postby jps on Sun Aug 15, 2010 3:07 am

The json module only appeared in Python 2.6, which means you'll need the beta version (http://www.sublimetext.com/beta) of Sublime Text for it to work: Sublime Text 1.3 is still using Python 2.5.
jps
Site Admin
 
Posts: 3062
Joined: Wed Mar 19, 2008 12:33 pm

Re: Simplenote plugin

Postby ulterior on Sun Aug 15, 2010 6:15 am

Ah, of course. Thanks so much for your help, it works great!
ulterior
 
Posts: 3
Joined: Fri Aug 13, 2010 11:25 pm

Re: Simplenote plugin

Postby SteveCooperOrg on Wed Aug 18, 2010 6:18 am

@ulterior -- glad you got it working. Let me know how it goes.

@jps -- thanks for helping, Jon!
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Simplenote plugin

Postby jbjornson on Wed Aug 18, 2010 2:09 pm

Any way to get this working from behind a corporate proxy?

By the way, the plugin doesn't handle the missing configuration file very well.

Otherwise, I'm curious to see this working...
jbjornson
 
Posts: 340
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: Simplenote plugin

Postby SteveCooperOrg on Wed Aug 18, 2010 4:09 pm

@jbjornson -- I've updated the plugin so that there is now a new command in the package menu; you can now click through "Tools | Packages | Simplenote | Edit Simplenote Config File" and it will open the config file. If that doesn't yet exist, it will be created and it's up to you to fill in the username, password, and working directory. After changes, you'll need to restart ST to have them take effect. Hopefully that makes it easier to get the file in the right place and in the right format.

What's happening on your corporate proxy? I don't think there's anything going on except standard web traffic, albeit over HTTPS. The URLs used all look something like

Code: Select all
https://simple-note.appspot.com/api/login


So you may want to make sure traffic to this site, and over HTTPS, is allowed.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Re: Simplenote plugin

Postby jbjornson on Thu Aug 19, 2010 11:51 am

I did eventually get the config file in the right location but what I meant before is that the error handling wasn't very graceful when the config file isn't there. I'm sure the config file editor will be helpful when setting up the plugin. Thanks.

The corporate proxy requires that all internet traffic going outside of the intranet is directed through a proxy that is authenticated via NTLM. The connection to to the http/https site has to be done through the proxy. All traffic to the "outside world" is blocked unless it goes through the proxy. I guess there should be some way to define the proxy url and port for the connection that you are making to the simple-note api on...
jbjornson
 
Posts: 340
Joined: Tue Oct 27, 2009 4:25 pm
Location: Zurich, Switzerland

Re: Simplenote plugin

Postby SteveCooperOrg on Thu Aug 19, 2010 1:46 pm

@jbjornson;

I'm not sure how to proceed with this, really -- this is outside my experience and I don't have a proxy to try it with. If you wanted to try to write a patch, I could suggest a few places in the code you'd want to edit. Here's what I got so far;

in simplenote.py, changeset 2 (3b7dacd23edc);

on line 1, start using urllib2, which supports proxies;

Code: Select all
-from urllib import urlopen
+from urllib2 import urlopen


line 385; add proxy option loading code like;

Code: Select all
      if 'proxy url' in d:
        self.proxy= d['proxy url']


which will add those properties to the setup object. Then at the end of Load(), if the proxy was specified, add your authentication code;

from http://bytes.com/topic/python/answers/22918-proxy-authentication-using-urllib2;

Code: Select all
# set up authentication info
authinfo = urllib2.HTTPBasicAuthHandler()
authinfo.add_password('realm', 'host', 'username', 'password')
proxy_support = urllib2.ProxyHandler({"http" : "http://ahad-haam:3128"})
# build a new opener that adds authentication and caching FTP handlers
opener = urllib2.build_opener(proxy_support, authinfo,
urllib2.CacheFTPHandler)
# install it
urllib2.install_opener(opener)


I've not tried this at all, but I thought I'd dump all the thinking I've done here. Let me know how it goes; if you do get it to work, post the patch here and I'll update.
Maybe what you're looking for is at the http://www.sublimetextwiki.com
SteveCooperOrg
 
Posts: 193
Joined: Thu Mar 20, 2008 9:53 am

Next

Return to Plugin Announcements

Who is online

Users browsing this forum: No registered users and 5 guests