Thor77 / screencloud-lutim

Screencloud-Plugin for Lutim
2 stars 1 forks source link

Troubles when I will upload a picture #1

Closed kadogo closed 9 years ago

kadogo commented 9 years ago

Hi, I installed your screencloud plugin for lutim but I have a little problem. When I will upload an image, I have this error:

I use the plugin out of the box (with the URL https://lut.im/)

Upload failed! Failed to call LutimUploader.upload() Traceback (most recent call last): File "", line 81, in upload TypeError: cannot concatenate 'str' and 'SSLError' objects

(And somtimes I have this error too)

Failed to call LutimUploader.showSettingsUI()

Thanks for your help.

Thor77 commented 9 years ago

Hey, thanks for your report! Please run python -c "import requests; requests.get('https://lut.im/')" and send me the whole output.

kadogo commented 9 years ago

Here you are ^^:

C:\Python27>python -c "import requests; requests.get('https://lut.im/')" Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\requests\api.py", line 55, in get return request('get', url, _kwargs) File "C:\Python27\lib\requests\api.py", line 44, in request return session.request(method=method, url=url, _kwargs) File "C:\Python27\lib\requests\sessions.py", line 357, in request resp = self.send(prep, _send_kwargs) File "C:\Python27\lib\requests\sessions.py", line 460, in send r = adapter.send(request, _kwargs) File "C:\Python27\lib\requests\adapters.py", line 362, in send raise SSLError(e) requests.exceptions.SSLError: hostname 'lut.im' doesn't match either of 'tontonroger.org', 'www.tontonroger.org'

Thor77 commented 9 years ago

Uhm, thats weird. For me everything works fine and the ssl-certificate also looks fine for me. Did you try to access the site with your browser? Did you get a certificate-warning?

kadogo commented 9 years ago

From my browser no certificate warning. Is it possible that come that I use python 2.7 on Windows ?

Can you maybe add a possibility to use HTTPS and verify the certificate ?

Thank for your fast answers

Thor77 commented 9 years ago

requests provides an option for verifying certs. Please try python -c "import requests; requests.get('https://lut.im/', verify=True)" to see if this will solve the problem.

kadogo commented 9 years ago

With python -c "import requests; requests.get('https://lut.im/', verify=True)" I have the same errors but if I use verify=False

python -c "import requests; requests.get('https://lut.im/', verify=False)" It is ok.

Thor77 commented 9 years ago

Yeah, thats the expected behaviour. But it's not really secure to not verify the cert... Feel free to just edit this line locally for you, but i won't include that into master.

kadogo commented 9 years ago

Not possible to do like an option that we can untick if we will ?

Edit: If I modify the line your say so: r = requests.post(url, verify=False, data={'delete-day': delay, 'format': 'json', 'first-view': int(self.delete_on_firstview)}, files={'file': open(tmpFilename)}).json()

I have the next error. https://imgur.com/txa5ipH

Edit2: Sorry it appear once time only. But the link given by screenscloud not work Exemple: https://lut.im/uEgasR1h/SjaHjYVj (Is the problem be me ?)

Thor77 commented 9 years ago

You can try to visit https://lut.im and download the cert

Firefox

  1. Click the lock-symbol
  2. More information
  3. View certificate
  4. Details -> Export
  5. Double-click the cert-file. It should be added to your windows-cert-manager.

Chrome

  1. Click the lock-symbol
  2. Connection
  3. Certificate-Information
  4. Details -> Export
  5. Double-click the cert-file. It should be added to your windows-cert-manager.

Yes, good idea. Will add that option soon.

kadogo commented 9 years ago

Sorry I edit my message before (if you can read ^^).

I just tried to export the certificate and install it on my system but I have the SSL Error (OS problem maybe).

Thor77 commented 9 years ago

I have to figure out how to suppress this InsecureRequestWarning in a good way. Never tested the plugin on a windows-system... seems like i should do that.

kadogo commented 9 years ago

It's not the place but it if you can help me ^^ It seem that in Debian Jessie I have others issues with pyopenssl.

https://imgur.com/UORmIE4

If you have an idea.

kadogo commented 9 years ago

It can maybe help on Windows problem. I test in IDLE a this.

https://zerobin.net/?95d3e682f9f38b45#F5SKpWdJVsBihh1vr0crcMD1PIwqG31e//7lJEyk238=

When I append "46Bh2EPk/LwXzollJ" to my URL I see my image and delete after I'm seeing.

Hope it can help.

Thor77 commented 9 years ago

Just added a ssl-verify-option. It should solve your first problem. I think the problem on windows is the tmp-path to the image (main.py - L75), because it uses / as seperator between temp-folder and file-name, but windows needs \\ as seperator.

kadogo commented 9 years ago

Thanks for ssl-verify option ^^

I was fault. The add of 'rb' is enough. I forgot to restart screencloud...

(I think add 'rb' on Linux work too, if you can test it and close the bug if it is good). Thanks.

Thor77 commented 9 years ago

Works fine on windows with opening the file in rb-mode, lets try on linux.

Thor77 commented 9 years ago

Please let me know, if your problem is solved with the latest commit.

kadogo commented 9 years ago

Perfect for me (on Windows). rb-mode is for read binary, I see the tips here.

https://stackoverflow.com/questions/2159794/why-python-on-windows-cant-read-an-image-in-binary-mode

Thor77 commented 9 years ago

Thanks for your help!