Hi! I need your help

Basenko

Registered Member
Joined
Jun 4, 2024
Messages
68
Reaction score
16
Does anyone know how to change the user agent, preferably with country switching as well? I'm looking for a way to do this effectively. Is anyone else working with this kind of setup?
 
Where need to change the user agent? If it is in requests, then you need to specify it in the headers.
To change the country, you need to use a proxy
Code:
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}

proxies = {
'http': 'http://username:password@proxy_ip:port',
'https': 'http://username:password@proxy_ip:port',
}

response = requests.get('https://example.com', headers=headers, proxies=proxies)
 
you can change the user agent using browser extensions, custom scripts, or proxies. If you also need country switching, residential proxies with rotating IPs might be your best bet.
 
Where need to change the user agent? If it is in requests, then you need to specify it in the headers.
To change the country, you need to use a proxy
Code:
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'}

proxies = {
'http': 'http://username:password@proxy_ip:port',
'https': 'http://username:password@proxy_ip:port',
}

response = requests.get('https://example.com', headers=headers, proxies=proxies)
I was informed that on a MacBook, in the development and browser identification settings, you can choose a different user agent. Have you ever used this feature?
 
you can change the user agent using browser extensions, custom scripts, or proxies. If you also need country switching, residential proxies with rotating IPs might be your best bet.
you can change the user agent using browser extensions, custom scripts, or proxies. If you also need country switching, residential proxies with rotating IPs might be your best bet.
What do you mean by residential proxies?
 
I was informed that on a MacBook, in the development and browser identification settings, you can choose a different user agent. Have you ever used this feature?
why not store the user-agents in an array then loop through them?
 
why not store the user-agents in an array then loop through them?
I’ve thought about doing this too, but I’m not sure about the implementation. How would you go about setting up the array and looping through the user-agents dynamically?
 
Why not just use a rotating proxy service? I've had good luck finding decent ones with a quick search.
 
User agent and country are two separate things, so you need two pieces:


  • User agent: a browser extension like “User-Agent Switcher”, or Chrome DevTools → More tools → Network conditions → uncheck “Use browser default”. In code, set the header in Playwright/Puppeteer or cURL.
  • Country: the user agent doesn’t change it, because sites see your IP. You need a VPN or a proxy with country selection (residential proxies for the most reliable results), plus matching timezone, language and geolocation. DevTools → Sensors can override the last three.

For a Laravel/WordPress testing setup, the easiest combo is Playwright with a per-country proxy and a custom user agent in each browser context. Are you doing this for testing your own sites, or for something like scraping or ad verification? The best setup differs.
 
Back
Top