0

Hi guys so i wanna check my gmail mail account through python 3 and for that i am using the google's gmail atom feed,here is my code

import urllib.request
import urllib.parse
import re
url='https://mail.google.com/mail/feed/atom'
req=urllib.request.Request(url)
resp=urllib.request.urlopen(req)
respData=resp.read()
numb=re.findall(r'<fullcount>(.*?)</fullcount>',str(respData))
print(numb)

now i want to return the <fullcount></fullcount>tag and once i run the code it throws an error HTTP Error 401: Unauthorized now i know this means i need to ad my gmail name and password but how can i do it? note that i added "python 3' in caps because topics related to gmail atom feed authentication are old and only in python 2 using mostly feedparser or urllib2 which wont work in python3. Thanks.

so people who mark this question as a duplicate are wrong you see the guy who marked this as a duplicate to a similar python 2 topic didnt exactly tell me how to translate the code in python 3 and there is still may attributes in the urllib in py2 like the HTTPBasicAuthHandler that is not in python 3 so please elaborate and answer properly this is a humble request from a noob thanks again

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112

0 Answers0