if page not load using bad proxy
See original GitHub issue`
#Get Proxy mylogs.info(f'Getting New IP') driver.proxy = get_random_proxy(proxies) while True: driver.execute_script("window.open('https://api.ipify.org?format=json')") driver.switch_to.window(driver.window_handles[-1]) json_response = json.loads(driver.find_element_by_tag_name('body').text) if json_response == 0: mylogs.error(f'Proxy not working retrying...') driver.close() driver.switch_to.window(driver.window_handles[0]) continue else: proxy_ip = json_response['ip'] mylogs.info(f'Your new IP is: {proxy_ip}') driver.close() driver.switch_to.window(driver.window_handles[0]) break
`
can you help me to figure this problem
because if json_response == 0:
not help me and if the page not open i got crash
i nead if i get bad gateway or page not reachable make return and get new proxy until get the new IP
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to Fix “There Is Something Wrong With the Proxy Server ...
1. Check if You Have a Stable Internet Connection · 2. Restore Your Proxy Server to Its Default Settings · 3. Disabling Your...
Read more >How to fix "There is something wrong with the proxy server ...
How to Fix Can't Connect to Proxy Server Issue on Windows 10 · Method 1: Checking if your Connection is Stable · Method...
Read more >Stuck with Proxy Error? Ways to Solve It - Smartproxy
Here's the way: Applications > System Preferences > Network > Advanced > Proxies. There you can check if you selected the right proxies....
Read more >Websites don't load - troubleshoot and fix error messages
Click Settings…. The Connection Settings dialog will open. Change your proxy settings: If you don't connect to the Internet through a proxy (or...
Read more >Page not loading with proxy but works without - Stack Overflow
If I don't use the proxy the page loads just fine. My code looks like the following. public static void main (String[] args)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for asking, but it’s fine - I do it for the love of it 😁
If the response is not returning valid JSON, then
json.loads()
will raise an exception - it won’t be0
. So try wrapping thejson.loads()
call in a try/except - for example: