Closed 69ScubaDiver closed 5 years ago
BTW ..... I have checked out /issues/47 but I do not have a directory /config/scripts/Notify/OpenSSL
Hi,
I'll try to address the 2 issues i can see off hand with your question:
It the error No module named nzbget
means that the docker container isn't quite set up properly.
But if you can gain shell access to it:
docker exec -it <mycontainer> bash
You should be able to just install the nzbget package and fix things for yourself:
pip install pynzbget
Then everything should work again. You may want to file a bug against the person who maintains the docker container to just include that pip command (provided above) too and then it should work for you out of the box.
This is in reference to your test call to the notification script. You'll want to tweak your URL just a wee bit to follow the slack setup:
python sabnzbd-notify.py complete -D -t 'Hello' 'World' \
slack://xxxxx/xxxx/xxxx
Good luck!
Thank You ... Issue 1 - Quite correct - Need to install nzbget.. However pip not available .... - I will contact person who maintains the docker container to include pip.
Issue 2 - Thank you for the advice ... Will do as advised...
Another question please ....
I have installed done this step
pip install pynzbget
I now get this error
/usr/local/lib/python2.7/dist-packages/requests/__init__.py:91: RequestsDependencyWarning: urllib3 (1.25.1) or chardet (3.0.4) doesn't match a supported version! RequestsDependencyWarning) 2019-05-09 21:51:30,281 - 293 - ERROR - Could not initialize World instance. 2019-05-09 21:51:30,281 - 293 - ERROR - Could not initialize slack://hooks.slack.com/services/xxxx/xxx/xxxx instance. 2019-05-09 21:51:30,282 - 293 - ERROR - Could not initialize Hello instance. 2019-05-09 21:51:30,282 - 293 - ERROR - Could not initialize -b instance
Any advice on resolving the RequestsDependencyWarning unsupported version
According to this post you have some mixed versions. This is partially a result of my advice (sorry).
If you follow the link, there are A LOT of suggestions and after scanning through them.
Basically the pip
command i suggested you run earlier hauled in some packages that are newer the the ones that ship with the OS (though apt
or rpm
... i'm not sure what OS your container uses). Either way, the solution is to effectively remove the redundant packages via apt and/or pip.
You could try running (as root)
# force pip to fetch an updated version of requests
pip install requests
I now have installed pip to same version ......
Resolve ==> RequestsDependencyWarning
Now when I run
python sabnzbd-notify.py complete -D -t 'Hello' 'World' slack://hooks.slack.com/services/xxx/xxx/xxx
I get the following output/error .....
2019-05-10 18:38:49,407 - 1577 - ERROR - Could not initialize World instance.
2019-05-10 18:38:49,408 - 1577 - ERROR - Could not initialize slack://hooks.slack.com/services/xxx/xxx/xxx instance.
2019-05-10 18:38:49,408 - 1577 - ERROR - Could not initialize Hello instance.
For the life of me I cannot get idea for next steps
If i try below (with correct keys) it works perfectly
curl -X POST -H 'Content-type: application/json' --data '{"text":"Seems to be working !"}' https://hooks.slack.com/services/xxx/xxx/xxx
I went ahed and configured in SABnzbd... When I run a test Notification Sent!
The output in the logfile is 👍
2019-05-10 19:03:14,104::INFO::[config:853] Writing settings to INI file /config/sabnzbd.ini
2019-05-10 19:03:15,961::INFO::[api:790] Executing notification script
2019-05-10 19:03:15,961::INFO::[newsunpack:213] Running user script /config/nzb-notify/sabnzbd-notify.py(other, SABnzbd: Other Messages)
2019-05-10 19:03:16,790::INFO::[notifier:548] Successfully executed notification script /config/nzb-notify/sabnzbd-notify.py
However I do not get the notification in slack as per the test i did using curl
Hmm... it sounds good; it's rather strange it isn't working fo ryou.
It would be awesome if you could test using the script directly since the logs you shared are from SABnzbd (and not the notify script itself).
I'd almost be curious if you could open up a terminal and test your URL using the apprise tool (which is all this script wraps at the end of the day anyway).
docker exec -it <mycontainer> bash
# inside docker instance (the -vvvv GREATLY increase the verbosity)
apprise -vvvv -t 'Test Title' -b 'Test Body' slack://aaa/bbb/ccc
Alternatively, you could toggle the debug mode on the script (there is no easy way to do this, but hopefully this command will work for you):
# - You'll need to do this from inside the docker container
# - i'm taking a guess at the path of the script based on your previously shared logs
# - This 'should' toggle on DEBUG_MODE and will drastically increase the verbosity
# of your logs.
sed -i -e 's/^\(DEBUG_MODE =\).*/\1 True/g' /config/nzb-notify/sabnzbd-notify.py
Then try running the test again. Now keep in mind (before sharing the results), there is a LOT more information revealed in these logs. Don't accidentally post anything personal (such as your api keys as they may show up in several spots of the logs).
Good luck; hopefully we're getting closer.
Just a note.... When running:
# inside docker instance (the -vvvv GREATLY increase the verbosity)
apprise -vvvv -t 'Test Title' -b 'Test Body' slack://aaa/bbb/ccc
Result:
2019-05-10 - TRACE - URL slack:///TokenA/TokenB/TokenC/ unpacked as:
secure="False"
qsd="{}"
token_a="TokenA"
token_c="TokenC"
token_b="TokenB"
host="TokenA"
tag="set([])"
user="None"
path="/TokenB/TokenC/"
query="None"
password="None"
port="None"
include_image="True"
qsd+="{}"
qsd-="{}"
url="slack://TokenA/TokenB/TokenC/"
verify="True"
targets="[]"
fullpath="/TokenB/TokenC/"
schema="slack"
2019-05-10 - WARNING - No user was specified; using apprise.
2019-05-10 - WARNING - No channel(s) were specified.
2019-05-10 - ERROR - Could not load URL: slack:///TokenA/TokenB/TokenC/
2019-05-10 - ERROR - Failed to load notification url: slack:///TokenA/TokenB/TokenC/
2019-05-10 - ERROR - You must specify at least one server URL or populated configuration file.
However when I add the channel to post to on the end it works :
2019-05-10 23:17:17,386 - TRACE - URL slack:///TokenA/TokenB/TokenC/#general unpacked as:
secure="False"
qsd="{}"
token_a="TokenA"
token_c="TokenC"
token_b="TokenB"
host="TokenA"
tag="set([])"
user="None"
path="/TokenB/TokenC/"
query="%23general"
password="None"
port="None"
include_image="True"
qsd+="{}"
qsd-="{}"
url="slack://TokenA/TokenB/TokenC/%23general"
verify="True"
targets="['#general']"
fullpath="/TokenB/TokenC/%23general"
schema="slack"
2019-05-10 23:17:17,387 - WARNING - No user was specified; using apprise.
2019-05-10 23:17:17,387 - DEBUG - Loaded URL: slack://TokenA/TokenB/TokenC/#general/?verify=yes&overflow=upstream&image=yes&format=markdown
2019-05-10 23:17:17,387 - DEBUG - Slack POST URL: https://hooks.slack.com/services/TokenA/TokenB/TokenC (cert_verify=True)
2019-05-10 23:17:17,387 - DEBUG - Slack Payload: {'username': 'apprise', 'mrkdwn': True, 'channel': '##general', 'attachments': [{'footer': 'Apprise', 'color': '#3AA3E3', 'text': u'Test Body', 'title':u'Test Title', 'ts': 1557523037.387377, 'footer_icon': u'https://github.com/caronc/apprise/raw/master/apprise/assets/themes/default/apprise-info-72x72.png'}]}
2019-05-10 23:17:19,376 - INFO - Sent Slack notification to #general.
It seems that the Notify_slack documentation says the channel -- denoted by #general (or any other channel name) is NOT Required .... This is then actually wrong ....
If you omit the channel name the apprise
call fails
Including the channelName in the appraise
call Results in success....
Resolution Taking this further .... to SABnzbd...... For clarity of those reading this later ... On the Notifications Page:
sabnzbd-notify.py
slack://TokenA/TokenB/TokenC/#general
It is now working .... Thanks caronc -- Appreciate your assistance and guidance
The good news is we're both right... :slightly_smiling_face: .
#general
as you already determined is definitely the work around. I'll update the the script to accept no channel at all as being a valid URL as well.I'll hopefully push a small fix by the end of the weekend to handle an empty channel set though. Good find on your part and thanks for all your help tracking it down! :+1:
This bug is actually an issue with apprise and not nzb-notify. I've already (just recently) fixed it upstream. Thus, i think we're good to go.
I'm going to close off this ticket now; but feel free to open it if you have any questions! Or open another ticket if you want too for anything else that comes along.
Thank You Chris ..... Happy that this is Closed
I recently installed the docker container for linuxserver/sabnzbd in a Debian host and I haven't been able to make the script work.
I'm trying to use slack but I think the error is independent of that. I think it may be related to missing dependencies but it was my understanding that all the necessary components were in the Notify folder.
My scripts folder contains sabnzbd-notify.py, Notify.py and Notify folder.
In sabnzbd i run (with the actual key) ==>
python sabnzbd-notify.py complete -D -t 'Hello' 'World' https://hooks.slack.com/services/xxxxx/xxxx/xxxx
I get the following error:Traceback (most recent call last): File "/config/nzb-notify/Notify.py", line 159, in <module> from nzbget import SCRIPT_MODE ImportError: **No module named nzbget**
I also get the same error in sabnzbd when I select sabnzbd-notify.py under Script and when I hit Test Notification..... I get same error in the sabnzbd.log file
Any help will be appreciated