Best Python code snippet using pandera_python
main.py
Source:main.py  
1import time2import random3from Helper import Geo_Questions4from Helper import History_Questions5from Helper import Science_Questions6Geo_points = 07Geo_check = False8History_points = 09History_check = False10SM_points = 011SM_check = False12print("Welcome to the Academic Quiz Game!")13print("\n\n")14time.sleep(2)15name = input("Please tell me your name. ")16print(f"\nWelcome, {name.title()}! I hope you enjoy the game!")17time.sleep(1)18def choice_rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):19	20	print("\n\n")21	choice = input(f"{name.title()}, would you like to [R]ead the rules or [S]kip? ")22	23	if choice.upper() == 'R':24		rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)25	26	if choice.upper() == 'S':27	  time.sleep(1)28	  options(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)29	30	else:31		print(f"\nPlease enter a valid option.")32		choice_rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)33		34	35def rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):36	time.sleep(1.5)37	38	print("\nYou will be asked multiple choice questions about each of these categories: ")39	print("\n- U.S. and World Geography\n- U.S. and World History\n- Science/Math\n")40	41	time.sleep(2)42	print("\nAnswering correctly will give you a point and let you move on. If you answer incorrectly, you will have one more chance.")43	44	time.sleep(2)45	print("\n\nIf you get through all the questions, you will complete the category. Once you do this, you will be able to: ")46	print("\n- Move on to a different category\n- Practice the same category with randomly chosen questions\n- Quit the game\n")47	48	time.sleep(2)49	print("\nCompleting all the categories will cause the game to end. However, this game is not necessarilly about winning.")50	51	time.sleep(1.5)52	print("\nFinally, please DO NOT press any keys for no reason. Otherwise the game may crash.")53	time.sleep(1)54	after_rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)55def Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):56	choice = input(f"\n\nAre you sure you want to quit the game? y/n ")57	58	if choice.lower() == 'y':59		print(f"\nThank you for playing the game. Exiting now...")60		time.sleep(1)61		exit(1)62	63def after_rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):64	time.sleep(1.5)65	print("\n\n")66	choice = input(f"Enough with the rules. {name.title()}, are you ready to begin? y/n  ")67	if choice.lower() == 'y':68		print("\nSending you to the options menu...")69		options(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)70		71	elif choice.lower() == 'n':72  		Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)73  		after_rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)74		75	else:76		print("\nPlease pick a valid option.")77		after_rules(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)78		79def options(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):80	print("\n\n\nHere are the categories you can choose from: ")81	time.sleep(1)82	print("\n [1] U.S. and World Geography\n [2] U.S. and World History\n [3] Science/Math\n")83	choice = input("\nWhich category do you choose? [1], [2], or [3]  ")84	85	if choice == '1':86		print("\nSending you to U.S. and World Geography!")87		Geo_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)88	89	elif choice == '2':90		print("\nSending you to U.S. and World History!")91		History_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)92	93	elif choice == '3':94		print("\nSending you to Science/Math!")95		SM_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)96	97	else:98		print("\nPlease pick a valid option.")99		options(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)100	101def Switch(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):102	if Geo_check and History_check and SM_check:103		conclusion(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)104		105	elif Geo_check and History_check and not SM_check:106		time.sleep(1.3)107		print(f"\nYou only have Science/Math left, sending you there now...")108		SM_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)109			110			111	elif Geo_check and SM_check and not History_check:112		time.sleep(1.3)113		print(f"\nYou only have History left, sending you there now...")114		History_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)115	116	elif History_check and SM_check and not Geo_check:117		time.sleep(1.3)118		print(f"\nYou only have Geography left, sending you there now...")119		Geo_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)120		121	122	elif Geo_check and not SM_check and not History_check:123		time.sleep(1.3)124		choice = input("\nWould you like to go to [H]istory or [S]cience? ")125		126		if choice.upper() == 'H':127			print("\nSending you to U.S. and World History!")128			History_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)129		130		elif choice.upper() == 'S':131			print("\nSending you to Science!")132			SM_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)133		134		else:135			print("\nPlease pick a valid option.")136			Switch(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)137	138	139	elif History_check and not Geo_check and not SM_check:140		time.sleep(1.3)141		choice = input("\nWould you like to go to [G]eography or [S]cience and Math? ")142		143		if choice.upper() == 'G':144			print("\nSending you to U.S. and World Geography!")145			Geo_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)146		147		elif choice.upper() == 'S':148			print("\nSending you to Science/Math!")149			SM_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)150		151		else:152			print("\nPlease pick a valid option.")153			Switch(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)154	155	156	elif SM_check and not Geo_check and not History_check:157		time.sleep(1.3)158		choice = input("\nWould you like to go to [G]eography or [H]istory? ")159		160		if choice.upper() == 'G':161			print("\nSending you to U.S. and World Geography!")162			Geo_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)163		164		elif choice.upper() == 'H':165			print("\nSending you to U.S. and World History!")166			History_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)167		168		else:169			print("\nPlease pick a valid option.")170			Switch(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)171def CheckScore(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):172	return f"\n{name.title()}, you have {Geo_points} geography points, {History_points} history points, and {SM_points} science/mathematics points."173		174def Geo_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):175	176	time.sleep(1)177	print(f"\n\n\nWelcome to the Geography round!")178	time.sleep(1)179	print("\nYou will be given 3 questions, with 2 chances each. If you answer all 3 wrong, you will have to restart the category.")180	time.sleep(2)181	182	choice = input("\nWould you like to [P]roceed or [Q]uit? ")183	if choice.lower() == 'p':184		Geo_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)185	186	elif choice.lower() == 'q':187		Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)188		Geo_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)189		190	else:191		print("\nPlease pick a valid option.")192		Geo_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)193def Geo_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):194	Official = Geo_Questions()195	196	Final3 = random.sample(Official, 3)197	Wrong_Questions = 0198	199	for i in range(3):200		question = Final3[i]201		202		time.sleep(1.5)203		print(f"\n\n\nHere is question {i+1}:\n")204		time.sleep(1)205		206		print(question['question'])207		time.sleep(1.3)208		print(question['choice'])209		response = input("  ")210		211		if response == (question['right_answer']):212			print("\nCorrect! Moving on to the next question...")213			Geo_points += 1214		215		if response != (question['right_answer']):216			print("\n\nTry again.")217			time.sleep(1)218			response1 = input(question['choice'] + "\n  ")219		220			if response1 == (question['right_answer']):221				print("\nCorrect! Moving on to the next question...")222				Geo_points += 1223		224			elif response1 != (question['right_answer']):225				print(f"\nIncorrect. The correct answer was {question['right_answer']}. Moving on to the next question...") 226				time.sleep(2)227				Wrong_Questions += 1228		229		if Wrong_Questions >= 3:230			print("\n\nUh oh! You answered 3 questions wrong, so you must start again. Sending you back to question 1...")231			time.sleep(2)232			Geo_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)233			234	time.sleep(1)	235	print("\n\nCongratulations, you have made it through the round WITHOUT incorrectly answering 3 questions!")236	237	Geo_check = True238	239	After_Geo(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)240def After_Geo(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):241	time.sleep(1.3)242	print("\n\n\nHere are your options:")243	print("\n [1] Move on to a different category\n [2] Practice the same category with randomly chosen questions\n [3] Check your score\n [4] Quit the game\n")244	245	choice = input("Which option do you choose? [1], [2], [3], or [4] ")246	247	if choice == "1":248		Switch(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)249		250		251	elif choice == '2':252		print("\nSending you back to Geography!")253		Geo_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)254			255	elif choice == '3':256		print(CheckScore(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions))257		258		After_Geo(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)259		260		261	elif choice == '4':262		Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)263		After_Geo(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)264		265	else:266		print("\nPlease pick a valid option.") 267		After_Geo(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)268		269def History_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):270	271	time.sleep(1)272	print(f"\n\n\nWelcome to the History round!")273	time.sleep(1)274	print("\nYou will be given 3 questions, with 2 chances each. If you answer all 3 wrong, you will have to restart the category.")275	time.sleep(2)276	277	choice = input("\nWould you like to [P]roceed or [Q]uit? ")278	if choice.lower() == 'p':279		History_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)280	281	elif choice.lower() == 'q':282		Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)283		History_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)284	else:285		print("\nPlease pick a valid option.")286		History_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)287def History_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):288	289	Official = History_Questions()290	291	Final3 = random.sample(Official, 3)292	Wrong_Questions = 0293	294	for i in range(3):295		question = Final3[i]296		297		time.sleep(1.5)298		print(f"\n\n\nHere is question {i+1}:\n")299		time.sleep(1)300		301		print(question['question'])302		time.sleep(1.3)303		print(question['choice'])304		response = input("  ")305		306		if response == (question['right_answer']):307			print("\nCorrect! Moving on to the next question...")308			History_points += 1309		310		if response != (question['right_answer']):311			print("\n\nTry again.")312			time.sleep(1)313			response1 = input(question['choice'] + "\n  ")314		315			if response1 == (question['right_answer']):316				print("\nCorrect! Moving on to the next question...")317				History_points += 1318		319			elif response1 != (question['right_answer']):320				print(f"\nIncorrect. The correct answer was {question['right_answer']}. Moving on to the next question...") 321				time.sleep(2)322				Wrong_Questions += 1323		324		if Wrong_Questions >= 3:325			print("\n\nUh oh! You answered 3 questions wrong, so you must start again. Sending you back to question 1...")326			time.sleep(2)327			History_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)328			329	time.sleep(1)	330	print("\n\nCongratulations, you have made it through the round WITHOUT incorrectly answering 3 questions!")331	332	History_check = True333	334	After_History(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)335	336def After_History(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):337	time.sleep(1.3)338	print("\n\n\nHere are your options:")339	print("\n [1] Move on to a different category\n [2] Practice the same category with randomly chosen questions\n [3] Check your score\n [4] Quit the game\n")340	341	choice = input("Which option do you choose? [1], [2], [3], or [4] ")342	343	if choice == "1":344		Switch(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)345		346		347	elif choice == '2':348		print("\nSending you back to History!")349		History_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)350			351	elif choice == '3':352		print(CheckScore(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions))353		354		After_History(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)355		356		357	elif choice == '4':358		Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)359		After_History(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)360		361	else:362		print("\nPlease pick a valid option.") 363		After_History(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)364		365def SM_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):366	367	time.sleep(1)368	print(f"\n\n\nWelcome to the Science round!")369	time.sleep(1)370	371	print("\nYou will be given 3 questions, with 2 chances each. If you answer all 3 wrong, you will have to restart the category.")372	time.sleep(2)373	374	choice = input("\nWould you like to [P]roceed or [Q]uit? ")375	if choice.lower() == 'p':376		SM_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)377	378	elif choice.lower() == 'q':379		Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)380		381		SM_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)382  		383	else:384		print("\nPlease pick a valid option.")385		SM_Intro(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)386def SM_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):387	388	Official = Science_Questions()389	390	Final3 = random.sample(Official, 3)391	Wrong_Questions = 0392	393	for i in range(3):394		question = Final3[i]395		396		time.sleep(1.5)397		print(f"\n\n\nHere is question {i+1}:\n")398		time.sleep(1)399		400		print(question['question'])401		time.sleep(1.3)402		print(question['choice'])403		response = input("  ")404		405		if response == (question['right_answer']):406			print("\nCorrect! Moving on to the next question...")407			SM_points += 1408		409		if response != (question['right_answer']):410			print("\n\nTry again.")411			time.sleep(1)412			response1 = input(question['choice'] + "\n  ")413		414			if response1 == (question['right_answer']):415				print("\nCorrect! Moving on to the next question...")416				SM_points += 1417		418			elif response1 != (question['right_answer']):419				print(f"\nIncorrect. The correct answer was {question['right_answer']}. Moving on to the next question...") 420				time.sleep(2)421				Wrong_Questions += 1422		423		if Wrong_Questions >= 3:424			print("\n\nUh oh! You answered 3 questions wrong, so you must start again. Sending you back to question 1...")425			SM_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)426			427	time.sleep(1)428	print("\n\nCongratulations, you have made it through the round WITHOUT incorrectly answering 3 questions!")429	430	SM_check = True431	432	After_SM(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)433	434def After_SM(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):435	time.sleep(1.3)436	print("\n\n\nHere are your options:")437	print("\n [1] Move on to a different category\n [2] Practice the same category with randomly chosen questions\n [3] Check your score\n [4] Quit the game\n")438	439	choice = input("Which option do you choose? [1], [2], [3], or [4] ")440	441	if choice == "1":442		Switch(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)443		444		445	elif choice == '2':446		print("\nSending you back to Science!")447		SM_Main(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)448			449	elif choice == '3':450		print(CheckScore(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions))451		After_SM(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)452		453		454	elif choice == '4':455		Leave(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)456		After_SM(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)457		458	else:459		print("\nPlease pick a valid option.") 460		After_SM(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions)461def conclusion(Geo_points, Geo_check, Geo_Questions, History_points, History_check, History_Questions, SM_points, SM_check, Science_Questions):462	time.sleep(1.5)463	print("\n\n\nCongratulations! You have completed all three categories in the Academic Quiz Game!")464	465	time.sleep(1)466	print(f"\n{name.title()}, you scored {Geo_points} geography points, {History_points} history points, and {SM_points} science/mathematics points. Great job!")467	468	time.sleep(3)469	print("\nThank you for playing the game. If you want to play the game again, click the \"Run again\" button that will pop up in a few seconds.")470	time.sleep(3)...myleads 3.5.py
Source:myleads 3.5.py  
1"""2Script for easy report for whole team3"""4import requests5import json6import datetime7from datetime import timedelta8import os9today = datetime.date.today()10yesterday = today - timedelta(1)11year = str(today)12year = year[:5]13API_LIST = {"name1":"api1",14            "name2":"api2",15            "name3":"api3"16            }17def Start(geo_check):18    print(19"""s = ÐÐÐ/ÐЫÐÐ Ñазбивка по гео201 = ÐÑÑÑÑ Ð·Ð° ÑегоднÑ212 = ÐÑÑÑÑ Ð·Ð° вÑеÑа22Ðибо Ñкажи вÑеменной пеÑиод (вÑеменной ÑоÑÐ¼Ð°Ñ - ÐÐ-ÐÐ):""")23    date_report_first = today24    date_report_second = today25    date_first = input("С: ")26    if date_first == "1":27        None28    elif date_first == "2":29        date_report_first = yesterday30        date_report_second = yesterday31    elif date_first == "s":32        if geo_check:33            geo_check = 034            os.system('CLS')35            print ("Разбивка по гео оÑклÑÑена")36        else:37            geo_check = 138            os.system('CLS')39            print ("Разбивка по гео вклÑÑена")40        return geo_check41    else:42        date_second = input("Ðо: ")43        date_report_first = year[:5]+date_first44        date_report_second = year[:5]+date_second45    os.system('CLS')46    geo_counter, result = {}, {}47    summall, total = [0,0], [0,0]48    for el in API_LIST.keys():49        result[el] = {}50    for name,key in API_LIST.items():51        url = f"https://api.hasoffers.com/Apiv3/json?api_key={key}&Target=Affiliate_Report&Method=getConversions&fields[]=Country.name&fields[]=Goal.name&filters[Stat.date][conditional]=BETWEEN&filters[Stat.date][values][]={date_report_first}&filters[Stat.date][values][]={date_report_second}&data_start=2021-01-01&hour_offset=-1&limit=50000"52        holder = Report(url)53        try:54            for el, i in holder.items():55                if i["Default"] or i["Deposit"] or i["TestAccount"]:56                    result[name][el] = i 57                    geo_counter[el] = {"Default":0,"Deposit":0,"TestAccount":0}58        except: return geo_check59    if date_first in ["1","2"]:60        print (f"{date_report_second}")61    else:62        print (f"{date_report_first} - {date_report_second}")63    for name,el in result.items():64        print (name)65        for i,a in el.items():66            try:67                geo_counter[i]["Default"] += a["Default"]68                geo_counter[i]["Default"] -= a["TestAccount"]69                geo_counter[i]["Deposit"] += a["Deposit"]70                a["Default"] -= a["TestAccount"]71            except: None72            try:73                if geo_check:74                    if a['Default'] > 0 or a['Deposit'] > 0:75                        print (f"{i} - Leads: {a['Default']} - Deposits: {a['Deposit']}")76                total[0] += a["Default"]77                total[1] += a['Deposit']78                summall[0] += a["Default"]79                summall[1] += a['Deposit']80            except: None81        print (f"Total - Leads: {total[0]} - Deposit: {total[1]}\n")82        total = [0,0]83    if len(API_LIST) > 1:84        print (f"All - Leads: {summall[0]} - Deposit: {summall[1]}")85        if geo_check:86            for i,a in geo_counter.items():87                if geo_counter[i]["Default"] > 0 or geo_counter[i]["Deposit"] > 0:88                    print (f"{i} - Leads: {a['Default']} - Deposits: {a['Deposit']}")89    return geo_check90def Report(url):91    r = requests.get(url)92    text = json.loads(r.text)93    country = {}94    try: 95        for el in text['response']["data"]["data"]:96            goal = el["Goal"]["name"]97            if el["Country"]["name"] not in country:98                country[el["Country"]["name"]] = {"Default":0, "Deposit":0, "TestAccount":0}99                country[el["Country"]["name"]][goal] = 1100            else:101                if goal not in country[el["Country"]["name"]]:102                    country[el["Country"]["name"]][goal] = 1103                else:104                    country[el["Country"]["name"]][goal] += 1105    except: return print ("\nÐевеÑÐ½Ð°Ñ Ð´Ð°Ñа\n")106    return country107if __name__ == "__main__":108    print ("Разбивка по гео вклÑÑена")109    geo_check = 1110    while True:111        geo_check = Start(geo_check)...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
