Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBHZW-00ADux-NG for pgsql-www@arkaria.postgresql.org; Thu, 07 Dec 2023 16:49:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rBHZT-001H6w-Bx for pgsql-www@arkaria.postgresql.org; Thu, 07 Dec 2023 16:49:55 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rBHZT-001H6o-2T for pgsql-www@lists.postgresql.org; Thu, 07 Dec 2023 16:49:55 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rBHZP-009HAj-EN for pgsql-www@postgresql.org; Thu, 07 Dec 2023 16:49:53 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-54c70c70952so1605173a12.3 for ; Thu, 07 Dec 2023 08:49:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgug.de; s=google; t=1701967789; x=1702572589; darn=postgresql.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=SnRPrUZ0oMn98K1Jw/1LUgtjkUU6iZ9Uu8XZSYaOVao=; b=BmIW2TFmILDzI4MEmmY7BK7NLNsNr5BO+rzUmpnx8pcJpNzIB3eU9KxRfaeeb90SB9 TYJuER/ZLWQKC0jw+I9VTbAr3Lg3OZ0grHuH98A7ueyLXSTmQqZeEZmtRTJTgTgT7b1g Ps6jGu3u2YRQ03loB0r46FNiGgNNkvfQltR7st92aKvIRwfr4csHYqzUrF8Lq/wR2InT YU/c1tH3IRszgo8saUiu4w9nI9LTSKM64WKdZ9BV8VboxuBPt2dgvBs/TtE+pfSn9Otx NmUDn2V2J5iMXbGChiF4ufzQlbZkR0z4EqF/paOFyWy4H2GWVtfONVPpLRmKp7c9iWLL 5llw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701967789; x=1702572589; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=SnRPrUZ0oMn98K1Jw/1LUgtjkUU6iZ9Uu8XZSYaOVao=; b=sgmWH3CkZ1yWTin2L6DfW5BOsX4drDpxbxttHWUA26TJfwMSjfOHPj+Rac8r9122QG 9dpLjCyZ3fa0p0eljcI0kIPCWVP9ZFVow89tF1pyfjw7Nv7JqXQ6tq+RmCYgVf+AvIhT WNrFxG7uiVYqrHiZqhCxUK9ogDNIkH14FZiC/RGgUGXIPinj8IVABCnUq1JAF4Cn6vZg LyDkaT2IxEodcQ3TdmRECo/lYiVtv8ZpPGWvN6lWo+w0rd+UwgOspBhDCJsm4/76jP0F BrII9QDNQvp6m5zhax0T8g2nr3qC9ukrqQi6NGdesIGLCg3P0lD3/MWn2IkiWOaJBdms 7KEw== X-Gm-Message-State: AOJu0Yyqd/NBKfjNMYTEvp6NvQDQeYbQq7g6TA87/6ro2O6kfYYW+1K9 YvYynPOc/EsOxTRZm5yhYQsv+w== X-Google-Smtp-Source: AGHT+IEH2Zp8r3z0sNb2KkwqDV7+pAyNu7uUHNujVxaNmkIzPLeLaJol67lgk8KZ/c4mF6zI/kIP+Q== X-Received: by 2002:a17:906:fb9a:b0:a02:f8f4:45c7 with SMTP id lr26-20020a170906fb9a00b00a02f8f445c7mr1138373ejb.69.1701967788563; Thu, 07 Dec 2023 08:49:48 -0800 (PST) Received: from [192.168.0.20] ([212.86.37.42]) by smtp.gmail.com with ESMTPSA id n23-20020a170906689700b00a1b8829597fsm1024453ejr.114.2023.12.07.08.49.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Dec 2023 08:49:48 -0800 (PST) Content-Type: multipart/alternative; boundary="------------haF1UhFbpCBPIW0a10ZSoQUx" Message-ID: <25b24513-cf6f-406e-a04e-b3d834ad5398@pgug.de> Date: Thu, 7 Dec 2023 17:49:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: cannot download mbox with python To: Pierre Forstmann , daniel@yesql.se Cc: pgsql-www@postgresql.org References: Content-Language: en-GB From: Andreas 'ads' Scherbaum In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------haF1UhFbpCBPIW0a10ZSoQUx Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 07/12/2023 17:39, Pierre Forstmann wrote: > I've tried this: > > import requests > from urllib.parse import urlparse > > url = 'https://www.postgresql.org/list/pgsql-bugs/mbox/pgsql-bugs.202312' > #response = requests.get(url, auth=('xxx','yyy')) > session = requests.session() > session.auth = ('xxx','yyy') > response = session.get(url) > print('status: ' + str(response.status_code)) > print('... done') > print(response.content) The session.auth is still doing a basic http auth, not what you need here. Try opening your link in a browser in an anonymous window: https://www.postgresql.org/list/pgsql-bugs/mbox/pgsql-bugs.202312 It redirects you to the login, you need to emulate that path in your script, login into the website and then you can retrieve the mbox. -- Andreas 'ads' Scherbaum German PostgreSQL User Group European PostgreSQL User Group - Board of Directors Volunteer Regional Contact, Germany - PostgreSQL Project --------------haF1UhFbpCBPIW0a10ZSoQUx Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit
On 07/12/2023 17:39, Pierre Forstmann wrote:
I've tried this:

import requests
from urllib.parse import urlparse

url = 'https://www.postgresql.org/list/pgsql-bugs/mbox/pgsql-bugs.202312'
#response = requests.get(url, auth=('xxx','yyy'))
session = requests.session()
session.auth = ('xxx','yyy')
response = session.get(url)
print('status: ' + str(response.status_code))
print('... done')
print(response.content)

The session.auth is still doing a basic http auth, not what you need here.

Try opening your link in a browser in an anonymous window:

https://www.postgresql.org/list/pgsql-bugs/mbox/pgsql-bugs.202312

It redirects you to the login, you need to emulate that path in your script,
login into the website and then you can retrieve the mbox.

-- 
				Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project
--------------haF1UhFbpCBPIW0a10ZSoQUx--