0

looking for an advise. Everyday I scan the SalesForce to find new opportunities and update the data accordingly. I am looking for a library or method that will store the last_scan_day and create a timestamp afterwards. So that the next day when the code scans for new opportunities it knows what the last_scan_day was - only checks the data that is Date > last_scan_day and updates the timestamp with a new date. And so on. It is a very high level of what I am trying to do, but if anyone can direct me to the right python methods, that would be awesome.

Currently, this works for me in php, but I need to translate it to Python.

    $last_run_date = file_get_contents("./last_scan_date.txt");
    $last_run_date = str_replace("\n","",$last_run_date);

    $t = getDatetimeNow();
    $t = substr($t,0,19)."Z";
    file_put_contents("./last_scan_date.txt",$t);
Chique_Code
  • 1,422
  • 3
  • 23
  • 49
  • Hi Chique_Code, I think all your answers would be in module [datetime](https://docs.python.org/3/library/datetime.html). Can you show us what you have tried? – EvensF Apr 03 '20 at 20:39

1 Answers1

0

from datetime import date, timedelta

yesterday = date.today() + timedelta(days=-1)

Chique_Code
  • 1,422
  • 3
  • 23
  • 49