0

I'm having a lot of difficulty with the datefinder module in Python. I'm using gspread to fetch data from Google Sheets. I've got a method with 2 parameters: the email and entry. From entry (string of text) I'm extracting dates, which can be more than one. But when I try to add the results into a txt or csv file, it just won't work.

import datefinder

def check(email, entry):
     matches = datefinder.find_dates(entry)
     for match in matches:
          with open("myFile.txt", "a") as file:
                file.write(email)
                file.write("\n")
                file.write(match)

I've tried many combinations, and it seems to be something wrong with match. I tried parsing to string or even just grabbing match.day, match.month separately since the type is integer, but still got the same problem.

I used print to debug, it stays stuck repeating the first email until it throws gspread.exception.APIError: {'code': 429, 'message': "Quota exceeded for quota metric 'Read requests' and limit 'Read requests per minute per user' of service 'sheets.googleapis.com' for consumer ...

BUT, it works fine if I'm just printing:

import datefinder

def check(email, entry):
     matches = datefinder.find_dates(entry)
     for match in matches:
          print(email, match)

If it was a problem with the API, I wouldn't be able to print, so I don't know what else to try. And if I'm only inserting the email into txt/csv, it works. It exports fine.

Mike
  • 1
  • 1

0 Answers0