urllib2.HTTPError: HTTP Error 403



  • urllib2 no longer has any effect in Cinema 4D.
    It is worth mentioning that I did not change anything in my code. It was working like a charm.
    I doubt the latest windows update corrupted it.
    Are there any solutions to bypass this limitation?

    Traceback (most recent call last):
      File "C:\Users\Merk\Documents\GIT Projects\c4d_plugins\Symex\symex.pyp", line 74, in <module>
        check.UpdateAtStartUp(version, url, command = 1051407,)
      File "C:\Users\Merk\Documents\GIT Projects\c4d_plugins\Symex\res\modules\checkUpdate.py", line 171, in UpdateAtStartUp
        if NewVersion(version, url,)[0]:
      File "C:\Users\Merk\Documents\GIT Projects\c4d_plugins\Symex\res\modules\checkUpdate.py", line 68, in NewVersion
        htmlsource = urllib2.urlopen(url, cafile=f)
      File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 154, in urlopen
        return opener.open(url, data, timeout)
      File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 435, in open
        response = meth(req, response)
      File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 548, in http_response
        'http', request, response, code, msg, hdrs)
      File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 473, in error
        return self._call_chain(*args)
      File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 407, in _call_chain
        result = func(*args)
      File "C:\Program Files\MAXON\Cinema 4D R20\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 556, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 403: Forbidden
    


  • Hi could you share your code, without your code, it's hard to reproduce.
    Cheers,
    Maxime.



  • Code:

    import c4d, urllib2, os
    
    url = r"https://www.patreon.com/posts/24993001"
    
    f = os.path.join(os.path.dirname(c4d.storage.GeGetStartupApplication()), "resource", "ssl", "cacert.pem")
    
    urllib2.urlopen(url, cafile=f)
    

    Error:

    Traceback (most recent call last):
      File "scriptmanager", line 7, in <module>
      File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 154, in urlopen
        return opener.open(url, data, timeout)
      File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 435, in open
        response = meth(req, response)
      File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 548, in http_response
        'http', request, response, code, msg, hdrs)
      File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 473, in error
        return self._call_chain(*args)
      File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 407, in _call_chain
        result = func(*args)
      File "C:\Program Files\MAXON\Cinema 4D R20 Demo\resource\modules\python\libs\win64\python27.vs2008.framework\lib\urllib2.py", line 556, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 403: Forbidden
    


  • hello,

    we did run a couple of test and seems that the "issue" is on Patreon side.

    HTTP Error 403: Forbidden

    We did try with other url, it work.
    We did try adding header-agent or things like that, it failed.

    They probably changed something on their server that doesn't allow to connect with python with default parameters.
    You have to contact them in order to know what you have to do.

    Cheers
    Manuel


Log in to reply