Ejemplo n.º 1
0
def get_fb_token():
  print("Getting Facebook token...")
  fb_token = fb_auth_token.get_fb_access_token(config.get_val('fb_email'), config.get_val('fb_password'))
  if not fb_token:
    print('Error getting Facebook token')
    return
  config.set_val('fb_token', fb_token)

  fb_id = fb_auth_token.get_fb_id(fb_token)
  if not fb_id:
    print('Error getting Facebook ID')
    return
  config.set_val('fb_id', fb_id)
Ejemplo n.º 2
0
def get_run_time():
  now = datetime.now()
  last_run = get_last_run_date()
  if now - last_run > timedelta(hours=12):
    return 0
  else:
    run_date = last_run + timedelta(hours=12)
    run_time = run_date.time()
    sleep_time = datetime.strptime(config.get_val('sleep_time'), "%H:%M").time()
    wake_time = datetime.strptime(config.get_val('wake_time'), "%H:%M").time()

    if sleep_time < run_time < wake_time:
      return wake_time.strftime("%H:%M")
    else:
      return run_time.strftime("%H:%M")
Ejemplo n.º 3
0
def start_session(wait=True):
  if int(config.get_val("suspended")):
    return
  if wait: random_wait()

  tinder.start_session()

  if not testing:
    set_last_run_date()
    set_session_scheduler()

  return schedule.CancelJob
Ejemplo n.º 4
0
def authverif():
    res = get_auth_token(config.get_val('fb_token'), config.get_val('fb_id'))
    if "error" in res:
        return False
    return True
Ejemplo n.º 5
0
def get_last_run_date():
  if config.val_exists('last_run'):
    return datetime.strptime(config.get_val('last_run'), "%Y-%m-%d %H:%M:%S")
  else:
    return datetime.min
Ejemplo n.º 6
0
def get_tinder_token():
  print("Getting Tinder token...")
  tinder.get_token(config.get_val('fb_token'), config.get_val('fb_id'))
Ejemplo n.º 7
0
def hot_or_not(rating):
    return rating > float(config.get_val('standard'))