On Fri, 24 Jul 2009 11:24:58 -0700, jakecjacobson wrote:

> I am trying to do a post to a REST API over HTTPS and requires the
> script to pass a cert to the server.  I am getting "exceptions.TypeError
> an integer is required" error and can't find the reason.  I commenting
> out the lines of code, it is happening on the connection.request() line.
>  Here is the problem code.  Would love some help if possible.

Please post the traceback that you get.

My guess is that you are passing a string instead of an integer, probably 
for the port.


[...]
>       except:
>               print sys.exc_type, sys.exc_value

As a general rule, a bare except of that fashion is bad practice. Unless 
you can explain why it is normally bad practice, *and* why your case is 
an exception (no pun intended) to the rule "never use bare except 
clauses", I suggest you either:

* replace "except:" with "except Exception:" instead.

* better still, re-write the entire try block as:


    try:
        [code goes here]
    finally:
        connection.close()

and use the Python error-reporting mechanism instead of defeating it.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to