Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"I am, therefore I am." -- Akira


devel / comp.lang.python / basic auth request

SubjectAuthor
o basic auth requestRobin Becker

1
basic auth request

<mailman.414.1629219767.4164.python-list@python.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=19055&group=comp.lang.python#19055

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: robin@reportlab.com (Robin Becker)
Newsgroups: comp.lang.python
Subject: basic auth request
Date: Tue, 17 Aug 2021 10:20:37 +0100
Lines: 16
Message-ID: <mailman.414.1629219767.4164.python-list@python.org>
References: <07b8928a-fe1f-958b-3ee2-d0f6ec51d414@everest.reportlab.co.uk>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de enaXprHQYZovR/BmiAkEwQRDQAEHlnPZuvPELyvUwZ5g==
Return-Path: <python-python-list@m.gmane-mx.org>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.003
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'auth': 0.09; 'porting':
0.09; 'received:ciao.gmane.io': 0.09; 'received:gmane.io': 0.09;
'received:list': 0.09; '%s"': 0.16; 'becker': 0.16; 'conversion':
0.16; 'encoding': 0.16; 'input.': 0.16; 'python3': 0.16;
'received:116.202': 0.16; 'received:116.202.254': 0.16;
'received:116.202.254.214': 0.16; 'robin': 0.16; 'value?': 0.16;
'issue': 0.20; 'to:addr:python-list': 0.23; 'idea': 0.25;
'subject:request': 0.29; 'header:User-Agent:1': 0.31; 'there':
0.31; 'but': 0.31; 'skip:w 40': 0.32; 'way': 0.37; 'skip:r 30':
0.61; 'skip:b 10': 0.62; 'clear': 0.65; 'received:116': 0.71;
'direct': 0.73
X-Injected-Via-Gmane: http://gmane.org/
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
X-Mozilla-News-Host: news://news.gmane.org:119
Content-Language: en-US-large
X-Mailman-Approved-At: Tue, 17 Aug 2021 13:02:46 -0400
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://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: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <07b8928a-fe1f-958b-3ee2-d0f6ec51d414@everest.reportlab.co.uk>
 by: Robin Becker - Tue, 17 Aug 2021 09:20 UTC

While porting an ap from python2.7 to python3 I see this

base64string = base64.b64encode('%s:%s' % (wsemail, wspassword))
request.add_header("Authorization", "Basic %s" % base64string)

in python3.x I find this works

base64string = base64.b64encode(('%s:%s' % (wsemail, wspassword)).encode('ascii')).decode('ascii')
request.add_header("Authorization", "Basic %s" % base64string)

but I find the conversion to and from ascii irksome. Is there a more direct way to create the basic auth value?

As an additional issue I find I have no clear idea what encoding is allowed for the components of a basic auth input.
--
Robin Becker


devel / comp.lang.python / basic auth request

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor