ntfy icon indicating copy to clipboard operation
ntfy copied to clipboard

SSL Exceptions when using single file binary

Open krohrsb opened this issue 8 years ago • 7 comments

$ ntfy -b pushover -o user_key secret_token send 'Pushover test!'
ERROR: Failed to send notification using pushover
Traceback (most recent call last):
  File "/usr/local/bin/ntfy/ntfy/__init__.py", line 34, in notify
    module.notify(message=message, title=title, **backend_config)
  File "/usr/local/bin/ntfy/ntfy/backends/pushover.py", line 107, in notify
    headers={'User-Agent': USER_AGENT})
  File "/usr/local/bin/ntfy/requests/api.py", line 107, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/usr/local/bin/ntfy/requests/api.py", line 53, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/bin/ntfy/requests/sessions.py", line 468, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/bin/ntfy/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/bin/ntfy/requests/adapters.py", line 447, in send
    raise SSLError(e, request=request)
SSLError: [Errno 20] Not a directory

Where my secret_token is replaced with my actual user token.

Thoughts?

krohrsb avatar May 16 '16 16:05 krohrsb

Interesting.. how did you install ntfy? (other useful info potentially: which ntfy & ntfy --version)

dschep avatar May 16 '16 17:05 dschep

I installed it similar to the readme instructions. Only difference I had to put it in /usr/local/bin due to some restrictions I have on my current system.

$ which ntfy & ntfy --version
[1] 57451
/usr/local/bin/ntfy
[1]  + 57451 done       which ntfy
2.0.1

krohrsb avatar May 16 '16 18:05 krohrsb

Thanks, I'll check it out when I get a chance (not super easy since I don't own a mac)

dschep avatar May 16 '16 18:05 dschep

Just got a similar report via email from a user on a RaspberyPi. Bad QA on my part, it seems to be an issue with the using requests from the single file binary. The problem presents on Linux too. I'll try get a fix ASAP. For now, please pip install from PyPi:

$ sudo pip install ntfy

dschep avatar May 18 '16 16:05 dschep

Thanks! using sudo pip install ntfy works.

krohrsb avatar May 20 '16 16:05 krohrsb

https://stackoverflow.com/questions/35973137/sslerror-not-a-directory seems to be close to the problem. In theory this should happen on Windows too when using a single exe version ntfy.

ghost avatar Aug 27 '16 05:08 ghost

same error happened

Linux version 4.4.0-36-generic (buildd@lcy01-01) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2) ) #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016
ntfy --version
2.2.0

Installed:

sudo /usr/bin/easy_install pip
sudo /usr/local/bin/pip psutil

git clone https://github.com/dschep/ntfy.git ntfy.git
pushd ntfy.git
bash zipapp.sh
cp dist/ntfy ~/bin/

Configured:

backends:
    - pushbullet
pushbullet:
    access_token: ......

Failed:

ntfy -l DEBUG done echo

INFO: Starting new HTTPS connection (1): api.pushbullet.com
ERROR: Failed to send notification using pushbullet
Traceback (most recent call last):
  File "/home/minhoryang/bin/ntfy/ntfy/__init__.py", line 65, in notify
    **backend_config)
  File "/home/minhoryang/bin/ntfy/ntfy/backends/pushbullet.py", line 34, in notify
    headers=headers)
  File "/home/minhoryang/bin/ntfy/requests/api.py", line 111, in post
    return request('post', url, data=data, json=json, **kwargs)
  File "/home/minhoryang/bin/ntfy/requests/api.py", line 57, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/minhoryang/bin/ntfy/requests/sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/minhoryang/bin/ntfy/requests/sessions.py", line 585, in send
    r = adapter.send(request, **kwargs)
  File "/home/minhoryang/bin/ntfy/requests/adapters.py", line 477, in send
    raise SSLError(e, request=request)
SSLError: [Errno 20] Not a directory

FYI, Bypassed:

REQUESTS_CA_BUNDLE=ntfy.git/build/zipapp/requests/cacert.pem ntfy done echo

and

sudo pip install certifi
ntfy done echo

also worked by http://docs.python-requests.org/en/master/user/advanced/#ca-certificates

minhoryang avatar Sep 11 '16 08:09 minhoryang