Skip to content

Commit 68ca185

Browse files
committed
Change prompt as per review
1 parent 548372d commit 68ca185

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/arguments/api_test.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff 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):

0 commit comments

Comments
 (0)