I have a script which processes data relating to the previous provided by an e-mail which arrives everyday at 00:30. So the data for the 30th March 2019 would be sent at 00:30 on 31st March. I extract the e-mails using the following code in Python 2.7
server = imaplib.IMAP4_SSL(HOST)
server.login(USERNAME, PASSWORD)
server.select('INBOX'
rv, data = server.search(None,'FROM', From, 'SUBJECT', Subject,'SENTSINCE', from_date)
The code ran perfectly for 3 months until the move to British Summer Time (I am based in the UK). Checking the data, the mail was seen by imap as received at 23:30 on 30th March instead of 00:30 on 31st March. My SENTSINCE was 31-Mar-2019 and imap was not returning any message.
My timezone is GMT standard time, and when I use datetime, I get the correct time adjusted for daylight savings. My question is how can I set the timezone so that imaplib interpretes the time correctly?