Jump to content

jeffsui

Member
  • Posts

    93
  • Joined

  • Last visited

  • Days Won

    7

Posts posted by jeffsui

  1. I've run into the situation with a bunch of my workflows where I like to return a status line of sorts.

     

    For example on my emoji workflow I show a match count.

     

    I use the `valid=False` command to make sure you cant interact with it but it still gets a  ⌘1 hotkey.

     

     

    Screen Shot 2016-09-15 at 7.35.23 PM.png

     

    I suggest the following possible change:

     

    Could there be a flag such as `header=True` and this item would serve as a header item.

     

    You could only have a single header per results returned and if you had multiple it would just take the last one (or the first one) and render it like a header line.  It would not be assigned a hotkey but would server as a header of sorts.

     

    (just an idea)

  2. 2 hours ago, deanishe said:

    Add a CA_CERTS variable in the workflow configuration sheet and let people put a path in there if they need it?

     

    
    client = httplib2.Http(ca_certs=os.getenv('CA_CERTS') or None)

     

    AFAIK, this is the first time anyone has had an issue with CA certificates in a workflow. It's usually company proxies that are the problem.

     

    Like I said, the only reason I can think of that your company would require you to trust their own self-signed cert in order for this workflow to work is so they can spy on you using the Lenovo/Superfish technique.

     

    Yes - they perform a man-in-the-middle attack on all traffic in and out. :)

     

    (new version being posted ... had a small bug in not passing the workflow variable around)

     

    https://github.com/jeeftor/alfredToday/releases/tag/v3.9.3

     

  3. So the line is a little misleading because (and I'm not a networking master) 

     

    The ca_certs file is a trust store of which SSL certificates to trust.  In my case because my office self-signs I had to add our custom certs into the trust store manually - I may have also had to create that file.  

     

    The disable_ssl_certificate_validation in theory should say "who cares about the trust store just trust everything"  

     

    Thus having both in there seems kind of dumb.  

     

    I guess I could add some options in there to give you the choice of SSL but I think the risk of somebody spoofing either an exchange server or google to serve up fake calendar events is EXTREMELY un-likely.  But I would say its an acceptable risk.

     

    My next goal is to improve the quick look view with some nice HTML templates per-chance and update the regex support to take a standard list of meeting providers at some point.  

     

  4. 6 hours ago, MEs said:

    Thanks a lot for your hard work on this issue.

     

    Solution 3 in your previous post didn't work for me. Here is what Terminal showed during the process if this may help :

     

    
    If your browser is on a different machine then exit and re-run this
    application with the command-line parameter 
    
      --noauth_local_webserver
    
    Traceback (most recent call last):
      File "authorize_google.py", line 64, in <module>
        main()
      File "authorize_google.py", line 60, in main
        credentials = get_credentials()
      File "authorize_google.py", line 53, in get_credentials
        credentials = tools.run_flow(flow, store, flags, http=HTTP_INSTANCE)
      File "lib/oauth2client/util.py", line 135, in positional_wrapper
        return wrapped(*args, **kwargs)
      File "lib/oauth2client/tools.py", line 235, in run_flow
        credential = flow.step2_exchange(code, http=http)
      File "lib/oauth2client/util.py", line 135, in positional_wrapper
        return wrapped(*args, **kwargs)
      File "lib/oauth2client/client.py", line 2117, in step2_exchange
        headers=headers)
      File "lib/httplib2/__init__.py", line 1609, in request
        (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
      File "lib/httplib2/__init__.py", line 1351, in _request
        (response, content) = self._conn_request(conn, request_uri, method, body, headers)
      File "lib/httplib2/__init__.py", line 1272, in _conn_request
        conn.connect()
      File "lib/httplib2/__init__.py", line 1036, in connect
        self.disable_ssl_certificate_validation, self.ca_certs)
      File "lib/httplib2/__init__.py", line 80, in _ssl_wrap_socket
        cert_reqs=cert_reqs, ca_certs=ca_certs)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 911, in wrap_socket
        ciphers=ciphers)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 520, in __init__
        self._context.load_verify_locations(ca_certs)
    IOError: [Errno 2] No such file or directory

     

    AHHA!!

     

    I would say there is a 100% change the error is related to this call.

    HTTP_INSTANCE = httplib2.Http(disable_ssl_certificate_validation=True, ca_certs="/usr/local/etc/openssl/cert.pem")
    

    Where I work we use stupid SSL Inspection and self signed cert shenanigans.  

     

    You could try changing the line to:

    HTTP_INSTANCE = httplib2.Http(disable_ssl_certificate_validation=True)
    

    Alternatively you could also try to just create a blank file at:

    /usr/local/etc/openssl/cert.pem
    

    but i'm not sure that would help.

     

    I'd be curious to know which if either of these guys will fix your problem.  I'll look into sticking with no SSL verification only which "should" work (hopefully).

     

    Or you could just try v3.9.1 out if you don't feel like editing anything :)

     

     

  5. So I'm using the Google Calendar API which uses OAuth.  It appears to create a local mini-webserver and use that to connect whit eh Google API to download the credentials.  I'm currently working on setting up 3 thigns

     

    1) MUCH better logging so that you can see in the logs if there is an error with oAuth stuff (aka can't bind to a socket)

     

    2) The ability to kill the server task if its left running somehow.  In my testing it appears sometimes it doesn't auth correctly and then blocks further auth request until you issue a

     

    pkill -f python

    3) I'll add directions on how to manually authenticate.  

     

    Right now you might  be able to 

    * Right click on Alfred Today and select 'Open in Terminal'

    * Then type  python authorize_google.py but i'm not sure if its setup correctly in the current build.  I was hoping to make a much "cleaner" way for people to do this.  

     

     

  6. So in regards to this line:

    using_cached_data = wf.cached_data_fresh('use_exchange', cache_time) and wf.cached_data_fresh('use_google', cache_time)

    (and of course i need a comment) all it controls is whether the output display "Using Cached Data" or "Action took x seconds to complete" - so the and is good.  

     

     

    I think i already have the workflow updating with:

     

     

    if __name__ == '__main__':
        wf = Workflow3(libraries=['./lib'],
                       update_settings={
                           'github_slug': 'jeeftor/alfredToday',
                           'frequency': 7}
                       )
        wf.run(main)
    

    As for resting the cache - I"m doing it manually because I want to reset "most" fields but not all - however maybe I'll make a today debug menu.  Thats a good idea...

  7. Looking over your stack trace the only time I think it is calling this stuff is here:

     

    And that should be only valid if the use_exchange variable is set.  I made a small change that defaults the calendars to both exchange and google to be off when you start up.  its possible you need to manually disable exchange in your build.  

    if use_exchange:
    outlook_events = wf.cached_data(outlook_cache_key, outlook_wrapper, max_age=cache_time)
    
    ....
    
    #Fire off in the background the script to update things! 
    run_in_background('update_exchange', cmd)
    

    I pushed a new version to github.  

     

    Do you mind giving it a go:

    https://github.com/jeeftor/alfredToday/releases/tag/v3.4.4

  8. Did you disable exchange support? It sure looks like its trying to hit an Exchange server - which doesn't make sense.  I'll see about looking into that.  In the mean time can you try to turn off exchange with the tc command.  Or maybe turn it on and then off.  You can also try tcreset

     

    In the mean time I'll take a look at the code to see if i can find why its being "evil"

     

     

     

    Still not working for me :(
     
    Here's the full log from the log file (Alfred's debugger can't show the log messages from background scripts):

    17:56:18 workflow.py:2157 DEBUG    Workflow version : 3.0.0
    17:56:19 workflow.py:1558 DEBUG    Reading settings from `/Users/daj/Library/Application Support/Alfred 3/Workflow Data/org.jeef.today/settings.json` ...
    17:56:20 doubleQuery.py:69 INFO     /Users/daj/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/org.jeef.today
    17:56:20 background.py:188 DEBUG    Command arguments cached to `/Users/daj/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/org.jeef.today/update_exchange.argcache`
    17:56:20 background.py:192 DEBUG    Calling [u'/usr/bin/python', '/Users/daj/Dropbox/Config/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F5D6A609-FA7B-4159-82D7-A8D64DB79904/workflow/background.pyc', 'update_exchange'] ...
    17:56:21 workflow.py:2157 DEBUG    Workflow version : 3.0.0
    17:56:21 workflow.py:2195 DEBUG    Workflow finished in 0.120 seconds.
    17:56:21 workflow.py:2195 DEBUG    Workflow finished in 0.122 seconds.
    17:56:21 background.py:236 DEBUG    Task `update_exchange` running
    17:56:21 background.py:237 DEBUG    cmd : ['/usr/bin/python', u'/Users/daj/Dropbox/Config/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F5D6A609-FA7B-4159-82D7-A8D64DB79904/updateOutlook.py', '2016-09-10-04:00:01', '2016-09-11-03:59:59', '0']
    17:56:21 background.py:197 DEBUG    Executing task `update_exchange` in background...
    17:56:21 doubleQuery.py:13 INFO     Refreshing Data Cache [Google]
    17:56:21 workflow.py:2157 DEBUG    Workflow version : 3.0.0
    17:56:21 updateOutlook.py:80 DEBUG    [u'2016-09-10-04:00:01', u'2016-09-11-03:59:59', u'0']
    17:56:21 workflow.py:1829 DEBUG    Cached data saved at : /Users/daj/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/org.jeef.today/event_list.google.0.cpickle
    17:56:21 workflow.py:2351 DEBUG    Set last run version : 3.0.0
    17:56:21 workflow.py:2195 DEBUG    Workflow finished in 3.055 seconds.
    17:56:22 updateOutlook.py:29 INFO     Refreshing Data Cache [Outlook]
    17:56:22 updateOutlook.py:30 INFO     /Users/daj/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/org.jeef.today
    17:56:22 workflow.py:1558 DEBUG    Reading settings from `/Users/daj/Library/Application Support/Alfred 3/Workflow Data/org.jeef.today/settings.json` ...
    17:56:22 workflow.py:2175 ERROR    'NoneType' object is not iterable
    Traceback (most recent call last):
      File "/Users/daj/Dropbox/Config/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F5D6A609-FA7B-4159-82D7-A8D64DB79904/workflow/workflow.py", line 2168, in run
        func(self)
      File "/Users/daj/Dropbox/Config/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F5D6A609-FA7B-4159-82D7-A8D64DB79904/updateOutlook.py", line 104, in main
        new_set = build_event_set(new_events)
      File "/Users/daj/Dropbox/Config/Alfred 3/Alfred.alfredpreferences/workflows/user.workflow.F5D6A609-FA7B-4159-82D7-A8D64DB79904/updateOutlook.py", line 69, in build_event_set
        return (serialize_event(evt) for evt in events)
    TypeError: 'NoneType' object is not iterable
    17:56:22 workflow.py:2195 DEBUG    Workflow finished in 1.048 seconds.
    17:56:22 background.py:248 DEBUG    Task `update_exchange` finished
    17:56:22 workflow.py:1558 DEBUG    Reading settings from `/Users/daj/Library/Application Support/Alfred 3/Workflow Data/org.jeef.today/settings.json` ...
    17:56:22 workflow.py:2351 DEBUG    Set last run version : 3.0.0
     
    17:56:22 workflow.py:2195 DEBUG    Workflow finished in 1.379 seconds.
  9. So I pushed out a version 3.3 pre-release to: https://github.com/jeeftor/alfredToday/releases/tag/v3.3

     

    With regards to 

    get_value_from_settings()

    I honestly am very new to python and haven't really had a chance to learn its little tricks - like the get function - and this workflow is much worse than some of the others i've written because I initially did it by hand not using the workflow library - which is why there are many stub functions I never fully refactored out.

     

    Does the google calendar thing throw an error or just print out no events?

     

    I added some logging that should tell you how many events it's getting from the server and if there is some sort of connection error you should get much more detailed data.

    [2016-09-09 22:37:49][STDERR: input.scriptfilter] 22:37:48 workflow.py:2157 DEBUG    Workflow version : 3.3.0
    22:37:48 workflow.py:1558 DEBUG    Reading settings from `/Users/jstein/Library/Application Support/Alfred 3/Workflow Data/org.jeef.today/settings.json` ...
    22:37:48 workflow.py:2441 DEBUG    Update check not due
    22:37:48 doubleQuery.py:135 INFO     calling google_wrapper()
    22:37:48 doubleQuery.py:136 INFO          param: start_google = 2016-09-09T04:00:01.853665+00:00
    22:37:48 doubleQuery.py:137 INFO          param:   end_google = 2016-09-10T03:59:59.853712+00:00
    22:37:48 doubleQuery.py:138 INFO          param:   date_offse = 0
    22:37:48 doubleQuery.py:13 INFO     Querying Google Calendar 2016-09-09T04:00:01.853665+00:00 2016-09-10T03:59:59.853712+00:00 0
    22:37:48 doubleQuery.py:15 INFO     Refreshing Data Cache [Google]
    22:37:49 doubleQuery.py:61 INFO     Google returned 1 events
    22:37:49 workflow.py:1829 DEBUG    Cached data saved at : /Users/jstein/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/org.jeef.today/event_list.google.0.cpickle
    22:37:49 doubleQuery.py:243 INFO     Event Count   Google: 1
    22:37:49 doubleQuery.py:244 INFO     Event Count Exchange: 0
    22:37:49 doubleQuery.py:245 INFO     Event Count    Total: 1
    22:37:49 workflow.py:2351 DEBUG    Set last run version : 3.3.0
    22:37:49 workflow.py:2195 DEBUG    Workflow finished in 0.925 seconds.

    If you wanted to try to manually debug things you could try calling into the query_google_calendar(wf, start_google, stop_google, date_offset) with the parameters you see in the debug log (perhaps).  

     

    I'll look some more tomorrow - and see if i cant write out some stubs for debugging google stuff.  

     

    If you need to re-authorize you will have to delete 

    ~/.credentials/calendar-alfred-today.json

     however this should be handled now by the tcrest call now

  10. So if somebody is tech savvy it would probably be pretty easy to get the workflow working internally.  In fact pyexchange (the package i'm using) initially works only with internal servers - as opposed to external servers.  The problem is I dont have a server to test against.  

     

    If you are so inclined I can work with you to figure out what kind of authentication your internal server supports - and see if we can get it working that way. 

     

    This is very useful to me, thank you for making it! The workflow works great with Google Calendar. It does not seem to work with the internal exchange server my employer uses but as you point out at Packal this is not to be expected.

     

    Regarding Google Calendar I have one feature request: The workflow shows only my main calendar, I have several calendars (on the same account, e.g. one for work and one for private) and would like to show them all or ideally choose which ones to show. Would this be possible to fix?

     

     

    With regards to other calendars - should be doable.  Might take some time to get around to it but I'll def look into that as an enhancement.  

  11. This emoji workflow scrapes Unicode.org to pull down the latest set of emoji!!. On the first run, you must be connected to the Internet so that you can generate the initial Emoji set. As new emoji are released you are able to re-query unicode.org to download the latest emoji set. There may be situations where you have emoji that do not display correctly on osx but would render correctly on ios .  This is because the emoji list on ios and osx are updated at different times.  

     

    Commands:

    • init emoji
    • e <search string>

     

    The first time you run this workflow use the command init emoji to start the download process.

     

    To trigger an emoji search you use the e button and start typing a search term

     

    taco.png

     

     

    You can get funky and use - to exclude something such as in this case

     

    complexsearch.png

     

     

    https://github.com/jeeftor/EmojiTaco/releases

     

    Releases:

    *  0.9.6 - Added new commands like:

    *  0.9.28 - New Icon

    0.9.29 - Auto-Init if no emoji is loaded yet

    0.9.32 - Updated to support new Unicode.org file format

    0.9.36 - Added support for automated testing to detect changes in the Unicode source document.  A recent change disabled the plugin. 

    0.9.38 - Extra headers - Supports latest Unicode File format change

    0.9.54 - Latest and greatest - works and has been working for some time now :)  

    * 0.9.55 - Updated documentation to match what we have now

     

    Commands

    alt/option (⌥) - Show Unicode Values
    cmd (⌘) - Show Python String
    ctrl (⌃) - Show Python String decoded
    shift (⇧) - Display the image in QuickLook

     

  12. I was looking over some HTML that had IMG tags with raw base64 encoded images in them.

     

    Is this something alfred supports?

    <img  class='imga' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAMAAABiM0N1AAAAbFBMVEVHcEz/zE38uDn0kAz5mxr0kAr0kAv4vT/3oiH2mRb0jwv/z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