cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass arugments in python script from ReadApi

SOLVED
Highlighted
Contributor

How to pass arugments in python script from ReadApi

Hi

 

I am running a python script from readyAPi, where as python script have some arguments, like below, How to pass this arguments to python script from ReadyAPi

 

env =sys.argv[0] (Must pick the environment depending upon the environment we selected in readyAPi)
id = sys.argv[1] 
json_path = sys.argv[2](Must pick the response of the previous request in readyapi)
save_file_path = sys.argv[3](Must pick the file path)

 

Is there a way we can acheive, Passing the arugments to python script from ReadyAPi?

 

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: How to pass arugments in python script from ReadyApi

7 REPLIES 7
Highlighted
Community Manager

Re: How to pass arugments in python script from ReadApi

Community, can you help?🙂

 

@nmrao @richie @msiadak @HimanshuTayal 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Community Hero

Re: How to pass arugments in python script from ReadApi

Question is neither related ReadyAPI nor groovy.

 

Any ways, one could pass the arguments in the same way as it is called from the command line.



Regards,
Rao.
Highlighted
Contributor

Re: How to pass arugments in python script from ReadyApi

Hi @nmrao 

 

Thanks for the info.. This is related to the ReadyAPi, from Ready APi i am able to run the python script, where as the python script contains some arguments, so for those arguments i have to pass the values from readyApi,  So this can be achieved from Command line arguments? 

 

So the below argument values can be passed through command line, Please suggest.

 

env =sys.argv[0] (Must pick the environment depending upon the environment we selected in readyAPi)
id = sys.argv[1] 
json_path = sys.argv[2](Must pick the response of the previous request in readyapi)
save_file_path = sys.argv[3](Must pick the file path)

 

 

 

Highlighted
Community Hero

Re: How to pass arugments in python script from ReadyApi

I mean the same "the python script contains some arguments,"
You can google how you can pass arguments while calling a python script from command line.
Accordingly use same command from your groovy.


Regards,
Rao.
Highlighted
Community Leader

Re: How to pass arugments in python script from ReadyApi

@doubtsreadyapi  : What i would suggest is store the desired values in .txt file either in key-value pair or normal text and read that file in your python script.

 

Hope it will help.


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Highlighted
Contributor

Re: How to pass arugments in python script from ReadyApi

@HimanshuTayal 

 

Thanks you. Where as the values are dynamic. like one of the argument is to pass the response of the previous request. and one more argument is environment depending upon the enviornment we run the argument must change.

 

Highlighted
Community Hero

Re: How to pass arugments in python script from ReadyApi

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors