jakewaldron / PlexEmail

This script aggregates all new TV, movie and music releases for the past configured time then optionally writes to your web directory and sends out an email.
206 stars 32 forks source link

Cloudinary SSL Certificate Verify Failed #30

Closed staticlama closed 8 years ago

staticlama commented 8 years ago

I'm receiving the following error if I set the config file to use Cloudinary:

Traceback (most recent call last): File "C:\PlexEmail\plexEmail.py", line 961, in imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0) File "C:\PlexEmail\plexEmail.py", line 370, in processImage cloudinaryURL = uploadToCloudinary(imgLocation) File "C:\PlexEmail\plexEmail.py", line 415, in uploadToCloudinary response = cloudinary.uploader.upload(imgToUpload) File "C:\PlexEmail\cloudinary\uploader.py", line 16, in upload return call_api("upload", params, file = file, _options) File "C:\PlexEmail\cloudinary\uploader.py", line 201, in call_api response = urllib2.urlopen(request, _kw).read() File "C:\Python27\lib\urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "C:\Python27\lib\urllib2.py", line 431, in open response = self._open(req, data) File "C:\Python27\lib\urllib2.py", line 449, in _open '_open', req) File "C:\Python27\lib\urllib2.py", line 409, in _call_chain result = func(*args) File "C:\PlexEmail\cloudinary\poster\streaminghttp.py", line 172, in https_ope n return self.do_open(StreamingHTTPSConnection, req) File "C:\Python27\lib\urllib2.py", line 1197, in do_open raise URLError(err) urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate ve rify failed (_ssl.c:590)>

jakewaldron commented 8 years ago

Hmm, I'm not seeing this error when I run it. Could you try grabbing the latest cloudinary code from their repo and copy it over your cloudinary folder: https://github.com/cloudinary/pycloudinary

Take the contents of the cloudinary folder in that repo and put it into your scripts/cloudinary folder.

staticlama commented 8 years ago

Thanks Jake, I tried that and receive the same error:

C:\PlexEmail>C:\Python27\python.exe C:\PlexEmail\plexEmail.py

Traceback (most recent call last): File "C:\PlexEmail\plexEmail.py", line 961, in imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0) File "C:\PlexEmail\plexEmail.py", line 370, in processImage cloudinaryURL = uploadToCloudinary(imgLocation) File "C:\PlexEmail\plexEmail.py", line 415, in uploadToCloudinary response = cloudinary.uploader.upload(imgToUpload) File "C:\PlexEmail\cloudinary\uploader.py", line 16, in upload return call_api("upload", params, file = file, **options) File "C:\PlexEmail\cloudinary\uploader.py", line 209, in call_api raise Error("Error - %s" % str(e)) cloudinary.api.Error: Error - <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] ce rtificate verify failed (_ssl.c:590)>

Is this because I've never visited cloudinary on my server (it has no browser, well IE is locked down)?

On Thu, Mar 31, 2016 at 4:27 AM, jakewaldron notifications@github.com wrote:

Hmm, I'm not seeing this error when I run it. Could you try grabbing the latest cloudinary code from their repo and copy it over your cloudinary folder: https://github.com/cloudinary/pycloudinary

Take the contents of the cloudinary folder in that repo and put it into your scripts/cloudinary folder.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/jakewaldron/PlexEmail/issues/30#issuecomment-203568131

Kind Regards,

Dex Fortescue

staticlama commented 8 years ago

I've attached my config file also in case there are any glaring errors.

On Thu, Mar 31, 2016 at 10:20 AM, Dex Fortescue dsfortescue@gmail.com wrote:

Thanks Jake, I tried that and receive the same error:

C:\PlexEmail>C:\Python27\python.exe C:\PlexEmail\plexEmail.py

Traceback (most recent call last): File "C:\PlexEmail\plexEmail.py", line 961, in imageInfo = processImage(hash, imageInfo['thumb'], 'movie', 0, 0) File "C:\PlexEmail\plexEmail.py", line 370, in processImage cloudinaryURL = uploadToCloudinary(imgLocation) File "C:\PlexEmail\plexEmail.py", line 415, in uploadToCloudinary response = cloudinary.uploader.upload(imgToUpload) File "C:\PlexEmail\cloudinary\uploader.py", line 16, in upload return call_api("upload", params, file = file, **options) File "C:\PlexEmail\cloudinary\uploader.py", line 209, in call_api raise Error("Error - %s" % str(e)) cloudinary.api.Error: Error - <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] ce rtificate verify failed (_ssl.c:590)>

Is this because I've never visited cloudinary on my server (it has no browser, well IE is locked down)?

On Thu, Mar 31, 2016 at 4:27 AM, jakewaldron notifications@github.com wrote:

Hmm, I'm not seeing this error when I run it. Could you try grabbing the latest cloudinary code from their repo and copy it over your cloudinary folder: https://github.com/cloudinary/pycloudinary

Take the contents of the cloudinary folder in that repo and put it into your scripts/cloudinary folder.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/jakewaldron/PlexEmail/issues/30#issuecomment-203568131

config-sanitised.conf.txt

jakewaldron commented 8 years ago

Hmm, I don't think it was actually attached. I'll be trying to reproduce this on a windows box this weekend.

staticlama commented 8 years ago

Sorry attached now (to my earlier comment).

jakewaldron commented 8 years ago

That looks good to me and I tried on a windows machine today and was not able to reproduce it. What OS are you on?

staticlama commented 8 years ago

Thanks for the update. I'm using Windows Server 2012. I'll try again tonight.

On Mon, 4 Apr 2016, 15:20 jakewaldron notifications@github.com wrote:

That looks good to me and I tried on a windows machine today and was not able to reproduce it. What OS are you on?

— You are receiving this because you authored the thread.

Reply to this email directly or view it on GitHub https://github.com/jakewaldron/PlexEmail/issues/30#issuecomment-205141255

jakewaldron commented 8 years ago

Ahh ok, I just tried on a normal Windows OS and not a server class one. Maybe the server OS is more strict on the ssl...I'll look into the error with regards to that tomorrow.

staticlama commented 8 years ago

Yeah that may be the case, also I've never used the browser on that vm (as it's locked down) so not sure if maybe there are intermediate certificates missing?

Also I made a typo above, I have server 2012 r2 (standard). Thanks for your help and for the great app. Even without cloudinary PlexEmail is very useful.

On Mon, 4 Apr 2016, 15:34 jakewaldron notifications@github.com wrote:

Ahh ok, I just tried on a normal Windows OS and not a server class one. Maybe the server OS is more strict on the ssl...I'll look into the error with regards to that tomorrow.

— You are receiving this because you authored the thread.

Reply to this email directly or view it on GitHub https://github.com/jakewaldron/PlexEmail/issues/30#issuecomment-205144127

jakewaldron commented 8 years ago

From some research it looks like you might be able to add the cert to your requests\cacert.pem file.

Try following these steps and let me know if it works (I have attached the cloudinary cert):

http://stackoverflow.com/a/31915123

cloudinary.txt

EDIT: Actually nevermind, that won't work since cloudinary's package is using urlib2 and not requests.

jakewaldron commented 8 years ago

Sorry for all the random troubleshooting ideas. Without being able to reproduce it, I'm just shooting in the dark. This idea will switch to using http for the upload:

Can you modify the portion of code in plexEmail.py that looks like:

if ('upload_use_cloudinary' in config and config['upload_use_cloudinary']):
  cloudinary.config( 
    cloud_name = config['upload_cloudinary_cloud_name'],
    api_key = config['upload_cloudinary_api_key'],
    api_secret = config['upload_cloudinary_api_secret']
  )

To this:

if ('upload_use_cloudinary' in config and config['upload_use_cloudinary']):
  cloudinary.config( 
    cloud_name = config['upload_cloudinary_cloud_name'],
    api_key = config['upload_cloudinary_api_key'],
    api_secret = config['upload_cloudinary_api_secret'],
    upload_prefix = 'http://api.cloudinary.com'
  )
staticlama commented 8 years ago

Thanks Jake. Tried both the above suggestions:

Cheers

On Tue, 5 Apr 2016, 10:17 jakewaldron notifications@github.com wrote:

Sorry for all the random troubleshooting ideas. Without being able to reproduce it, I'm just shooting in the dark. This idea will switch to using http for the upload:

Can you modify the portion of code in plexEmail.py that looks like:

if ('upload_use_cloudinary' in config and config['upload_use_cloudinary']): cloudinary.config( cloud_name = config['upload_cloudinary_cloud_name'], api_key = config['upload_cloudinary_api_key'], api_secret = config['upload_cloudinary_api_secret'] )

To this:

if ('upload_use_cloudinary' in config and config['upload_use_cloudinary']): cloudinary.config( cloud_name = config['upload_cloudinary_cloud_name'], api_key = config['upload_cloudinary_api_key'], api_secret = config['upload_cloudinary_api_secret'], upload_prefix = 'http://api.cloudinary.com' )

— You are receiving this because you authored the thread.

Reply to this email directly or view it on GitHub https://github.com/jakewaldron/PlexEmail/issues/30#issuecomment-205555351

jakewaldron commented 8 years ago

Thanks for confirming that option works. Not optimal to have to use http, but at least it works.

I will add this option to the config file in the next release and close this issue once it is pushed to the main branch.

jakewaldron commented 8 years ago

This has been added to the dev branch. Closing this for now.