File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,17 @@ def fetch_input_url(cls):
4848 def save_response_data (cls ,response_data ):
4949 store_data = input ('Store response data? (Y/N): ' )
5050 if (store_data .lower () == 'y' ):
51- with open ('response_data.json' , 'w' ) as jsonFile :
51+ filename = input ("Enter a filename (response_data.json)" )
52+ if filename == '' :
53+ filename = 'response_data.json'
54+ with open (filename , 'w' ) as jsonFile :
5255 json .dump (response_data , jsonFile , indent = 4 )
53- print ("Response data stored in response_data.json " )
54- else :
56+ print (f "Response data stored in { filename } " )
57+ elif ( store_data . lower ()) == 'n' :
5558 print (f"You have entered { store_data } , So the response is not saved" )
56-
59+ else :
60+ print (f"You have entered { store_data } , please enter either Y or N" )
61+ cls .save_response_data (response_data )
5762 # formats the response data and prints it in json on console
5863 @classmethod
5964 def print_response_json (cls ,response ):
You can’t perform that action at this time.
0 commit comments