1

I have a scenario where I need to call a rest API in my python selenium script but I am not sure how to do it.

If anyone as idea on it can you please help me out .

The API used is to delete the phone number.

asked Nov 19, 2018 at 6:06

2 Answers 2

3

Request is the Python built-in HTTP library.

r = requests.get('https://api.github.com/user', auth=('user', 'pass'))
print( r.status_code ) # Print 200

If you want to systematic valid Rest Endpoints, you may want to look at pyresttest or Tavern.

answered Nov 19, 2018 at 7:02
0

Selenium just controls the browser, it is not intended to make rest calls. Selenium only lets you to GET particular URL (as you do when you request a regular html page from a server) using driver.get(..).

However I believe this is not your case because implementing data editing using GET requests is a sort of bad practice since it exposes high security risks.

So you should use dedicated libs like João advices.

answered Nov 19, 2018 at 22:51

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.