Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #34636 > unrolled thread

Establishing Https connection

Started bynenad.cikic@gmail.com
First post2012-12-11 10:26 -0800
Last post2012-12-11 18:25 -0800
Articles 4 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Establishing Https connection nenad.cikic@gmail.com - 2012-12-11 10:26 -0800
    Re: Establishing Https connection Kwpolska <kwpolska@gmail.com> - 2012-12-11 20:45 +0100
      Re: Establishing Https connection nenad.cikic@gmail.com - 2012-12-11 18:25 -0800
      Re: Establishing Https connection nenad.cikic@gmail.com - 2012-12-11 18:25 -0800

#34636 — Establishing Https connection

Fromnenad.cikic@gmail.com
Date2012-12-11 10:26 -0800
SubjectEstablishing Https connection
Message-ID<90968092-9853-4d8a-9bd6-ee42d4f8b2f8@googlegroups.com>
Hello,
Once I get my xml populated I have to send it to web service.
Should I use httplib?
I am reading the docs and I have managed to open the connection with 
httplib.HTTPSConnection(host[, port[, key_file[, cert_file[, strict[, timeout[, source_address]]]]]])
After that i intend to use
HTTPConnection.request('POST', url[, body[, headers]])

During opening it asks me for the password. I see that the urllib class has prompt_user_passwd() that can be overriden for the password supply, so that no console action is necessary, but with httplib how is done?
My questions are:
-am I using the right class?
-i intend to store certificate and private key in database, but how can I use them without saving back to file?

I have already developed applications for http/https but not in python, so I need some hint to point me in the right direction.

Thanks 
Nenad
 

[toc] | [next] | [standalone]


#34639

FromKwpolska <kwpolska@gmail.com>
Date2012-12-11 20:45 +0100
Message-ID<mailman.739.1355255140.29569.python-list@python.org>
In reply to#34636
On Tue, Dec 11, 2012 at 7:26 PM,  <nenad.cikic@gmail.com> wrote:
> Hello,
> Once I get my xml populated I have to send it to web service.
> Should I use httplib?
> I am reading the docs and I have managed to open the connection with
> httplib.HTTPSConnection(host[, port[, key_file[, cert_file[, strict[, timeout[, source_address]]]]]])
> After that i intend to use
> HTTPConnection.request('POST', url[, body[, headers]])
>
> During opening it asks me for the password. I see that the urllib class has prompt_user_passwd() that can be overriden for the password supply, so that no console action is necessary, but with httplib how is done?
> My questions are:
> -am I using the right class?
> -i intend to store certificate and private key in database, but how can I use them without saving back to file?
>
> I have already developed applications for http/https but not in python, so I need some hint to point me in the right direction.
>
> Thanks
> Nenad
>
> --
> http://mail.python.org/mailman/listinfo/python-list

I, for one, suggest <http://python-requests.org/> for your sanity.  I
guess it would be something along the lines of:

import requests
xml = """<?xml version="1.0" encoding="UTF-8" ?> ..."""
files = {'file-field-as-requested-by-the-service': xml}
requests.post(url, files=files, auth=HTTPDigestAuth('user', 'pass'))


Plus http://docs.python-requests.org/en/latest/user/advanced/#ssl-cert-verification
and other stuff from there.

Httplib may not be wrong, but I’m doing this for your sanity.
-- 
Kwpolska <http://kwpolska.tk>
stop html mail      | always bottom-post
www.asciiribbon.org | www.netmeister.org/news/learn2quote.html
GPG KEY: 5EAAEA16

[toc] | [prev] | [next] | [standalone]


#34676

Fromnenad.cikic@gmail.com
Date2012-12-11 18:25 -0800
Message-ID<7a7fecc4-3dbf-45f7-8de3-d9fd7cc677db@googlegroups.com>
In reply to#34639
Many thanks, I will check it.

Nenad

[toc] | [prev] | [next] | [standalone]


#34677

Fromnenad.cikic@gmail.com
Date2012-12-11 18:25 -0800
Message-ID<mailman.765.1355279160.29569.python-list@python.org>
In reply to#34639
Many thanks, I will check it.

Nenad

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web