def main(): queryString = " (( causeOfAction:01000000000000民事/01040000000000合同、无因管理、不当得利纠纷/01040010000000合同纠纷/01040010240000借款合同纠纷/01040010240010金融借款合同纠纷 )) " begin_date = "2018.03.20" end_date = "2018.03.31" datetime_range_list = dateRange(begin_date, end_date) payload = deepcopy(RequestConstant.SEARCH_PARAMS) payload["query"].update({"queryString" : queryString}) session = get_new_session() for the_date in datetime_range_list: time.sleep(5) day_for_save = the_date.replace(".", "-") flogger.info("新的一天: {}".format(the_date)) judgmentDate = "judgmentDate:[{} TO {}]".format(the_date, the_date) payload["query"].update({"filterDates" : [judgmentDate]}) docCount, searchId = detect_count(session, payload) if docCount <= 0: flogger.info("当前日期 {} 没有数据".format(the_date)) continue my_task_list = get_task_list(session, docCount, searchId, payload) if not my_task_list: save_fail(the_date) continue for task in my_task_list: process(session, task["payload"], task["nHits"], day_for_save)
def multiple_tests(setNum, start, end, ocr="google", requestMethod="multithread", searcher="standard"): for i in range(start, end + 1): print "***********************************" start = time.time() filename = 'questions/Set-' + str(setNum) + '/Q' + str(i) + '.png' result = detect_text(filename, ocr) print process(result, requestMethod, searcher) print "Total time: " + str(time.time() - start)
def start(): adb_android.pull("/data/local/tmp/logcat.txt",fuzzerConfig.path_to_save_logcat) search.process(fuzzerConfig.path_to_save_logcat)
def scrape_and_mail(keywords, email): try: return process(keywords, email) except Exception: return Exception
def do_POST(self): print 'Post Request' search.process()
def do_GET(self): self._set_headers() print self.path print 'Get Request' search.process()
def test_words_movies_for_not_empty_after_process(self): '''words_movies must not be empty after processed''' search.process() self.assertTrue(len(search.words_movies.items()) > 0)
def test_results_for_walt_disney(self): '''Results for walt disney must match example provided''' search.process() self.assertEqual(len(search.main("walt disney")), 53)
def test_movie_ids_same_length(self): '''movie_ids variable should have the same lenght as the number of files inside the data directory''' search.process() self.assertEqual(len(search.movie_ids), len(search.os.listdir(search.location)))
def single_test(filename, ocr="google", requestMethod="multithread", searcher="standard"): result = detect_text(filename, ocr) print process(result, requestMethod, searcher)