Jenkins: HTTP error 403 when getting config
Question: I try to update Jenkins jobs' config programmatically, and the [python Jenkins
api](http://packages.python.org/jenkinsapi/index.html) looked ok, but I can't
retrieve a config because of HTTP error 403 (forbidden):

    
    
    from jenkinsapi import api
    j = api.Jenkins('https://server.test.com/hudson', 'fp12210', 'xxxxxxxx')
    job = j.get_job('BBB-100-CheckStatusAll')
    conf = job.get_config()
    
    Traceback (most recent call last):
      ...
      File "C:\Python27\lib\urllib2.py", line 521, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    HTTPError: HTTP Error 403: Forbidden
    

Adding user and password in URL, [as mentionned in another SO
post](http://stackoverflow.com/questions/7427557/jenkins-and-github-webhook-
http-403), fails too:

    
    
     j = api.Jenkins('https://fp12210:xxxxxxxx@server.test.com/hudson')
    
    Traceback (most recent call last):
      ...
      File "build\bdist.win32\egg\jenkinsapi\utils\retry.py", line 39, in retry_function
        raise e
    InvalidURL: nonnumeric port: 'xxxxxxxx@server.test.com/hudson'
    

Do you have any idea ?


Answer: This [SO post](http://stackoverflow.com/questions/635113/python-urllib2-basic-
http-authentication-and-tr-im) is the solution. I now get an error 500, but
this is another story...

