Jump to content

Recommended Posts

Posted (edited)

Hey all,

 

I have just published the Alfred Confluence workflow.

The Alfred Confluence workflow let's you find and open Confluence pages and blog posts from Alfred.

Once installed and set up, just type c <search terms> ('c' standing for Confluence).

 

Download & Links:

 

I've tested with Alfred 3 and on macOS Sierra. Hope you find it useful.

 

Cheers,
-Stefan

Edited by Stefan Kleineikenscheidt

Share this post


Link to post

Hey Stefan,

 

Thank you for creating and publishing this workflow!  

 

I'm trying to use it and have run into an error, wondering if you may have any insight to the problem.  I am seeing "No JSON object could be decoded", when attempting a search.  (screenshot below) Seems like the authentication has worked, but I may have something misconfigured. 

 

Thanks for the help!

-Matt

Screen Shot 2017-05-16 at 2.26.23 PM.png

Share this post


Link to post
Posted (edited)

Hello, 

sorry.

But how to set baseUrl and other properties?

c confluence_baseurl https://wiki.example.com

doesn't work (it does nothing on return and continues to ask to set baseurl.

Edited by Dollar2048

Share this post


Link to post
11 minutes ago, Dollar2048 said:

Hello, 

sorry.

But how to set baseUrl and other properties?


c confluence_baseurl https://wiki.example.com

doesn't work (it does nothing on return and continues to ask to set baseurl.

 

sorry, I should not use "c" at the beginning. ))

 

 

Share this post


Link to post
On 5/17/2017 at 0:01 AM, mcoppola said:

Hey Stefan,

 

Thank you for creating and publishing this workflow!  

 

I'm trying to use it and have run into an error, wondering if you may have any insight to the problem.  I am seeing "No JSON object could be decoded", when attempting a search.  (screenshot below) Seems like the authentication has worked, but I may have something misconfigured. 

 

Thanks for the help!

-Matt

Screen Shot 2017-05-16 at 2.26.23 PM.png


Hi, 

 

- having the same error
- debug logs from when trying to run the workflow,

Starting debug for 'Confluence Quick Search v1.0.2'

[2017-06-04 15:59:31][ERROR: input.scriptfilter] Code 1: 15:59:30 workflow.py:1859 DEBUG    Loading cached data from : /Users/myusername/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.k15t.labs.alfredapp.confluence.quicksearch/__workflow_update_status.cpickle
15:59:30 workflow.py:2444 DEBUG    update_data : {u'available': False}
15:59:30 workflow.py:2225 DEBUG    Workflow version : 1.0.2
15:59:30 workflow.py:1628 DEBUG    Reading settings from `/Users/myusername/Library/Application Support/Alfred 3/Workflow Data/com.k15t.labs.alfredapp.confluence.quicksearch/settings.json` ...
15:59:30 workflow.py:2514 DEBUG    Update check not due
15:59:30 workflow.py:2633 DEBUG    Got password : com.k15t.labs.alfredapp.confluence.quicksearch:confluence_password
15:59:30 alfred-confluence.py:99 DEBUG    Quick Search URL: https://myconfluencepage.jira.com/wiki/rest/quicknav/1/search?os_authType=basic&query=v
15:59:31 workflow.py:2243 ERROR    No JSON object could be decoded
Traceback (most recent call last):
  File "/Users/myusername/alfred/Alfred.alfredpreferences/workflows/user.workflow.3843EB14-BDB0-474B-9840-DDE6E3DB23E4/lib/workflow/workflow.py", line 2236, in run
    func(self)
  File "alfred-confluence.py", line 108, in main
    result = r.json()
  File "/Users/myusername/alfred/Alfred.alfredpreferences/workflows/user.workflow.3843EB14-BDB0-474B-9840-DDE6E3DB23E4/lib/workflow/web.py", line 269, in json
    return json.loads(self.content, self.encoding or 'utf-8')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 351, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
15:59:31 workflow.py:2267 DEBUG    Workflow finished in 1.093 seconds.

Appreciate the help

Share this post


Link to post

Hi Stefan,

Configured by just typing 'confluence_baseurl' without the 'c' and still having the issue.
Below is the complete logs (earlier log filtered by Alfred's "interesting information")

[2017-06-06 10:13:27][ERROR: input.scriptfilter] Code 1: 10:13:25 workflow.py:1859 DEBUG    Loading cached data from : /Users/myusername/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data/com.k15t.labs.alfredapp.confluence.quicksearch/__workflow_update_status.cpickle
10:13:25 workflow.py:2444 DEBUG    update_data : {u'available': False}
10:13:25 workflow.py:2225 DEBUG    Workflow version : 1.0.2
10:13:25 workflow.py:1628 DEBUG    Reading settings from `/Users/myusername/Library/Application Support/Alfred 3/Workflow Data/com.k15t.labs.alfredapp.confluence.quicksearch/settings.json` ...
10:13:25 workflow.py:2514 DEBUG    Update check not due
10:13:25 workflow.py:2633 DEBUG    Got password : com.k15t.labs.alfredapp.confluence.quicksearch:confluence_password
10:13:25 alfred-confluence.py:99 DEBUG    Quick Search URL: https://mycompanyname.jira.com/wiki/rest/quicknav/1/search?os_authType=basic&query=myquery
10:13:26 workflow.py:2243 ERROR    No JSON object could be decoded
Traceback (most recent call last):
  File "/Users/myusername/alfred/Alfred.alfredpreferences/workflows/user.workflow.3843EB14-BDB0-474B-9840-DDE6E3DB23E4/lib/workflow/workflow.py", line 2236, in run
    func(self)
  File "alfred-confluence.py", line 108, in main
    result = r.json()
  File "/Users/myusername/alfred/Alfred.alfredpreferences/workflows/user.workflow.3843EB14-BDB0-474B-9840-DDE6E3DB23E4/lib/workflow/web.py", line 269, in json
    return json.loads(self.content, self.encoding or 'utf-8')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 351, in loads
    return cls(encoding=encoding, **kw).decode(s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
10:13:26 workflow.py:2267 DEBUG    Workflow finished in 1.070 seconds.
[2017-06-06 10:13:27][input.scriptfilter] <?xml version="1.0" encoding="utf-8"?>
<items><item valid="no"><title>Error in workflow 'com.k15t.labs.alfredapp.confluence.quicksearch'</title><subtitle>No JSON object could be decoded</subtitle><icon>/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns</icon></item></items>


Thanks!

Share this post


Link to post

Hi Stefan,

Afraid that didn't help. This is what I tried,
- there was no 
~/.alfred-confluence.json created
- and this error was happening

- so, created ~/.alfred-confluence.json
- tried again and still got same error

 

my confluence url is of format company.jira.com/wiki, will that change anything?

Share this post


Link to post

For what it's worth, I have also tried to create the ~/.alfred-confluence.json file, to no avail.  

 

Thanks for your help, Stefan.

 

-Matt

 

 

Share this post


Link to post
Posted (edited)

Hey Doctorwho,

it looks like you have configured https://mycompanyname.jira.com/wiki as Confluence Base Url, which is most probably not right. Please delete the ~/.alfred-confluence.json file and follow the step #3 from the getting started guide and make sure to use the correct Confluence Base URL.

 

If you cannot get this to work, please create again the ~/.alfred-confluence.json file and post its contents here.

 

-Stefan

 

PS: Matt, I believe you experience the same issue. Pls. try to do as describe above too.

Edited by Stefan Kleineikenscheidt

Share this post


Link to post

Stefan,

Had configured the base_url correctly, just didn't want to enter the name of my company and so used "mycompanyname"

Tried it again and got the same results.
There was no ~/.alfred-confluence.json file.
Attached is the contents of settings.json file from 
`/Users/myuser/Library/Application Support/Alfred 3/Workflow Data/com.k15t.labs.alfredapp.confluence.quicksearch/`,

{
  "__workflow_last_version": "1.0.2", 
  "confluence_baseUrl": "https://mycompanyname.jira.com/wiki/", 
  "confluence_username": "shriram@mycompanyname.com"
}



Also, one thing, debug log for the just tried attempt shows this, 

Quick Search URL: https://mycompanyname.jira.com/wiki//rest/quicknav/1/search?os_authType=basic&query=tick
18:57:24 workflow.py:2243 ERROR    No JSON object could be decoded

The URL returned has two "/" after https://myco.....com/wiki.
I typed in that URL in a browser tab and got a 404.
When I typed in the URL as "https://mycompanyname.jira.com/wiki/rest/quicknav/1/search?os_authType=basic&query=tick", a .json object was returned.
I had set the confluence_baseurl as: https://mycompanyname.jira.com/wiki 

Should I try something different?
Appreciate all the help.


Thanks,

Shriram
 

Share this post


Link to post

Hey Shiram,

 

confluence_baseurl should not have a trailing slash, have you removed it? (look up /Users/myuser/Library/Application Support/Alfred 3/Workflow Data/com.k15t.labs.alfredapp.confluence.quicksearch/).

 

It should look like this:

{
  "__workflow_last_version": "1.0.2", 
  "confluence_baseUrl": "https://mycompanyname.jira.com/wiki", 
  "confluence_username": "shriram@mycompanyname.com"
}

 

Cheers,
-Stefan

Share this post


Link to post

Our confluence doesn't use web form authentication (login form). It uses NTLM (?) or web auth (?) with Active Directory login. I'm not strong in NTLM etc. Signin works transparently from Windows PC, from macOS with standard web auth (screenshot: http://d.mikeozornin.ru/Wuz3Mx)


My settings are:

{
  "__workflow_last_version": "1.0.2", 
  "confluence_baseUrl": "https://wiki.ptsecurity.com", 
  "confluence_username": "mozornin"
}

With these settings and my password I got 401 Unauthorized.

 

Is it possible to use your workflow or our authentication is not supported?

Share this post


Link to post

I actually dove into your script a bit, from what it looked like it wasn't ungzipping the content correctly. I could be wrong, I only spent a few minutes with it in a debugger.

Share this post


Link to post
4 hours ago, djimenez said:

I actually dove into your script a bit, from what it looked like it wasn't ungzipping the content correctly. I could be wrong, I only spent a few minutes with it in a debugger.

 

Can you be more specific about that?

 

The workflow uses my Python library, which should take care of gzip content-/transfer-encoding transparently.

Share this post


Link to post

Also, we have gzip encoding enabled on our wiki and it still works.

This still looks like an authentication problem, when the actual call to the Confluence Quick Search is made. When I have some spare time, I'll add some more logging to better understand what is going on.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×