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


Groups > comp.lang.python > #34639

Re: Establishing Https connection

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!rt.uk.eu.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!news.nosignal.org!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <kwpolska@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'received:209.85.223': 0.03; '"""': 0.05; 'httplib': 0.09; 'wrong,': 0.09; 'suggest': 0.11; 'dec': 0.15; 'gpg': 0.16; 'hint': 0.16; 'i\xe2\x80\x99m': 0.16; 'skip:{ 40': 0.16; 'urllib': 0.16; 'wrote:': 0.17; 'requests': 0.18; 'are:': 0.20; 'import': 0.21; 'password.': 0.22; 'header:In-Reply-To:1': 0.25; 'guess': 0.27; 'message-id:@mail.gmail.com': 0.27; 'there.': 0.28; 'lines': 0.28; 'asks': 0.29; 'necessary,': 0.29; 'url:mailman': 0.29; 'class': 0.29; 'connection': 0.30; 'stuff': 0.30; 'point': 0.31; 'url:python': 0.32; 'url:listinfo': 0.32; '11,': 0.33; 'docs': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'along': 0.35; 'certificate': 0.35; 'open': 0.35; 'doing': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'but': 0.36; 'url:org': 0.36; 'should': 0.36; 'skip:p 20': 0.36; 'one,': 0.37; 'xml': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'store': 0.38; 'files': 0.38; 'some': 0.38; 'url:docs': 0.38; 'url:en': 0.38; 'to:addr:python.org': 0.39; 'hello,': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'your': 0.60; 'service.': 0.61; 'developed': 0.62; 'back': 0.62; 'of:': 0.65; 'saving': 0.72; 'url:tk': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=ULOU4TaiSm8dsB1NTyxyEPtUEzbknAj3j+uxHwP3GCk=; b=MKKzksxOM5c3FFOd2he85Cvb4khRRAymjGYSpEnmo2ek/IuWHOeCeptJoggLI7b2wU /ktg1EACp7mYzdS6LkFYDPlr0OvrVi9r/KdxiVTqOK13azB5GHGdpNSRfgTBsyzSDg4m jJRE9F+7S5laKeBxy0Rql0jjiFIC6I3phIXJpxZpnSgHnXkhVP2pkjps/Jbc/lF9iKyl v+MX3yLCGDweRzTfkwUFX9EwzjycRlrVdq88z6KE8CeWvFhwTUBLuDTtgKC1kTnNk00R lF1nDVOpK2JitTHV9c1B5+yMoC5W5Izp2bzCrBkPmWB/sooo2zJMe9n7Y51QYnvlw9K7 Pd1w==
MIME-Version 1.0
In-Reply-To <90968092-9853-4d8a-9bd6-ee42d4f8b2f8@googlegroups.com>
References <90968092-9853-4d8a-9bd6-ee42d4f8b2f8@googlegroups.com>
Date Tue, 11 Dec 2012 20:45:29 +0100
Subject Re: Establishing Https connection
From Kwpolska <kwpolska@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.739.1355255140.29569.python-list@python.org> (permalink)
Lines 46
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1355255140 news.xs4all.nl 6867 [2001:888:2000:d::a6]:45251
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:34639

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web