Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'debug': 0.07; 'http': 0.09; 'subject:skip:a 10': 0.09; 'cc:addr:python-list': 0.11; 'appreciated!': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'headers.': 0.16; 'request)': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'trying': 0.19; 'machine': 0.22; 'cc:addr:python.org': 0.22; 'sends': 0.24; 'header': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'login': 0.25; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'host': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'correctly.': 0.31; 'skip:q 20': 0.31; 'file': 0.32; 'subject:with': 0.35; 'connection': 0.35; 'created': 0.35; 'received:google.com': 0.35; '14,': 0.36; 'skip:4 10': 0.37; 'being': 0.38; 'work?': 0.38; 'does': 0.39; 'read': 0.60; 'establish': 0.61; 'name': 0.63; 'response.': 0.68; 'obvious': 0.74; 'saw': 0.77; 'application?': 0.84; 'to:none': 0.92 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:cc :content-type; bh=yp4wibqqvA7rl2QFIgRZpwgktJ2QwNPO9AEnzZ3U7Wo=; b=0ojZvg0sbD2fa8yzHEaA6Pn98KYopEH5Eb0GPmE5h0ZjSdV7oJLovrOzhDC0+DiVSR DOckQIlw29IWRGAXlTQNDw57VsG0KMxpzXELbrrF0wpZSnYJ+/Zs34+nVHkNSbV6Zh2I oXyjH31YnB+n39zHAzBnhQ7cavmYrXph3nsQssZ9mFbbJWqoRxR3a/3ke1OLwKGJmT1C erL7UiymWQknfP2wJmNZ6YM0ECQnfUXRNIrw+EWzgMVdtEl2Cb8v5c/CYQPNfnPcbmJx qf4ummkLvrIlBqJifRs5qfIxoILaBnY3yBd+HKP9jmDG2i5EQMS+MMfKK+48HpPyhvbh 1qEA== MIME-Version: 1.0 X-Received: by 10.52.136.98 with SMTP id pz2mr84571vdb.70.1400026284021; Tue, 13 May 2014 17:11:24 -0700 (PDT) In-Reply-To: References: Date: Wed, 14 May 2014 10:11:23 +1000 Subject: Re: httplib with NETRC authentication From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1400026287 news.xs4all.nl 2871 [2001:888:2000:d::a6]:59720 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71520 On Wed, May 14, 2014 at 9:33 AM, pratibha natani wrote: > I am trying to establish http connection to a gerrit host using netrc authentication. I have a netrc file created with following entries: > machine host1.com login name password pass > > I did a debug and saw that my netrc file is being read correctly. Also in the connection object(after sending request) a header got created with appropriate credentials: > 'headers': {'Authorization': 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ='} > > Still I get 401,Unauthorized in response. Any help would be greatly appreciated! The obvious question is: What *does* work? Does it work when you use wget, or some other application? Then go and look at what that sends for its authentication headers. Tip: It won't be "Authorization". ChrisA