R
R
Re7r02021-08-17 13:35:24
Python
Re7r0, 2021-08-17 13:35:24

Can't handle a problem in selenium?

There is code that uses requests:

import requests

driver = webdriver.Chrome()

headers = { 
    "apikey": "x9x03xx0-xx44-11xx-84xx0-x365x9x7xxxx"
}

params = (
   ("url","https://freegeoip.app/json/"),
   ("location","eu"),
)

response = requests.get('https://app.zenscrape.com/api/v1/get', headers=headers, params=params)

How to do also in selenium?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-08-17
@SoreMix

Through seleniumwire you can

from seleniumwire import webdriver

driver = webdriver.Chrome()

def interceptor(request):
    request.headers['apikey'] = 'x9x03xx0-xx44-11xx-84xx0-x365x9x7xxxx'
driver.request_interceptor = interceptor

driver.get('https://app.zenscrape.com/api/v1/get')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question