Re: cannot download mbox with python

From: Andreas 'ads' Scherbaum <ads(at)pgug(dot)de>
To: Pierre Forstmann <pierre(dot)forstmann(at)gmail(dot)com>, daniel(at)yesql(dot)se
Cc: pgsql-www(at)postgresql(dot)org
Subject: Re: cannot download mbox with python
Date: 2023-12-07 16:49:46
Message-ID: 25b24513-cf6f-406e-a04e-b3d834ad5398@pgug.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-www

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

In response to

Browse pgsql-www by date

  From Date Subject
Next Message Guillaume Lelarge 2023-12-10 07:39:59 Patch for new book edition
Previous Message Pierre Forstmann 2023-12-07 16:39:18 Re: cannot download mbox with python