Пример #1
0
 def test_database_update_search_status_error_payload(self):
     database = MySqlDataSouce()
     id = database.update_search_status_payload(1, "ERROR", "abcdedfg")
     self.assertEqual(0, id)
Пример #2
0
    if error_count > 5 :
        print("Error count reached sleeping " + ERROR_COUNT_SLEEP_SECONDS+ " seconds")
        error_count = 0
        time.sleep(ERROR_COUNT_SLEEP_SECONDS)

    print("Searching for word: " + word)
    id = dao.add_search_history(word, ENGLISH)
    if id <= 0 :
        print("Adding search history record errored with : " + id)
        continue
    try:
        result = fetcher.search_english_word(ENGLISH, word)
        error_count = 0
    except RateLimitException as e:
        print("Rate Limit exeception fetching: %s %s", word,  e.message)
        dao.update_search_status_payload(id, ERROR_RATE_LIMIT, e.message)
        time.sleep(EXCEPTION_SLEEP_SECONDS)
        error_count += 1
        continue
    except ClientPoolRateException as e:
        print("Client pool exeception fetching: %s %s", word,  e.message)
        dao.update_search_status_payload(id, ERROR_CLIENT_POOL, e.message)
        time.sleep(EXCEPTION_SLEEP_SECONDS)
        error_count += 1
        continue
    except UnknownErrorException as e:
        print("Unknown error exeception fetching: %s %s", word,  e.message)
        dao.update_search_status_payload(id, ERROR_UKNOWN, e.message)
        time.sleep(EXCEPTION_SLEEP_SECONDS)
        error_count += 1
        continue