chevron_left chevron_right
Login Register invert_colors photo_library


Stay updated and chat with others! - Join the Discord!
Thread Rating:
  • 0 Vote(s) - 0 Average


Tutorial Python Proxy Switcher basic tutorial filter_list
Author
Message
Python Proxy Switcher basic tutorial #1
Hi everyone,
I noticed there are a lot of people wanting to learn python and so I thought I'd write a really basic proxy switcher/tester in python for you to learn with.

You can use this to help with scraping or just for testing out a proxy list to see which ones work. It's mainly for learning though so it doesnt do anything fancy. Let me know if you need any help and like if its useful.

Code:
#we need to import a few things to make it work first
from lxml.html import fromstring
from itertools import cycle
import requests

#This sets a list of proxies. You can get this from many different sites.
PROXY_LIST = ['1.10.240.135:8080',
'101.109.142.5:8080',
'177.124.16.178:45817',
'101.109.110.221:8080']

#creates a 'pool' of proxies which is based on the list so it isn't one after another. This helps if you have many sequential proxies.
proxy_pool = cycle(PROXY_LIST)
#sets an empty list of working proxies which we will populate later
working_proxies = []
#sets the url you want to visit - this one just returns an IP address
url = 'https://www.canihazip.com/s'

#goes through each proxy in the PROXY_LIST - you could set the second part (where len(PROXY_LIST) is) to a big number if you wanted to keep testing.
for i in range(0,len(PROXY_LIST)):
 #Get the next proxy from the pool
 proxy = next(proxy_pool)
 print("Request #%d"%i)
 try:
     #print response from website
     response = requests.get(url, proxies={"http": proxy, "https": proxy})
     print("working proxy at:"+str(response.content))
     working_proxies.append(proxy)
 except:
     #if it doesnt work throw a connect error
     print("Connnection error")

#lists all working proxies, it converts the list to a set so it only shows unique values.
print("The working proxies are:"+ str(set(working_proxies)))

Reply

RE: Python Proxy Switcher basic tutorial #2
i want to learn python with gui interface that i can also make checker and many more.

Reply

RE: Python Proxy Switcher basic tutorial #3
(05-15-2019, 12:13 PM)fsociety Wrote: i want to learn python with gui interface that i can also make checker and many more.

The best GUI is probably tkinter - it comes packaged with python and its quite easy to use. It's not very fancy though - it will always look like a very basic windows application. If people are interested I can write a basic tkinter tutorial?

Reply

RE: Python Proxy Switcher basic tutorial #4
(05-16-2019, 11:27 AM)Sartux Wrote:
(05-15-2019, 12:13 PM)fsociety Wrote: i want to learn python with gui interface that i can also make checker and many more.

The best GUI is probably tkinter - it comes packaged with python and its quite easy to use. It's not very fancy though - it will always look like a very basic windows application. If people are interested I can write a basic tkinter tutorial?

if you are master in python than daily post some tutorial on youtube make video on how to make simple account checker with proxy .a giftcard checker like this.

Reply

RE: Python Proxy Switcher basic tutorial #5
(05-16-2019, 02:33 PM)fsociety Wrote:
(05-16-2019, 11:27 AM)Sartux Wrote:
(05-15-2019, 12:13 PM)fsociety Wrote: i want to learn python with gui interface that i can also make checker and many more.

The best GUI is probably tkinter - it comes packaged with python and its quite easy to use. It's not very fancy though - it will always look like a very basic windows application. If people are interested I can write a basic tkinter tutorial?

if you are master in python than daily post some tutorial on youtube make video on how to make simple account checker with proxy .a giftcard checker like this.

I don't have time to do daily youtube videos and I don't think that's the best way for people to learn anyway. Everyone will just copy whats in the videos and won't learn anything.

Account checkers are hard also because it depends what site/service you want to check - I can create an amazon account checker, but then it wont work for ebay etc.

The best way IMO is to teach the basics so you can learn to make what you want. I'll post a basic account checker tutorial soon and then you can build on that..

[+] 2 users Like Sartux's post
Reply

RE: Python Proxy Switcher basic tutorial #6
@Sartux you could add something like this:

Add to top of the code:
Code:
path = 'list.txt'

Replace:
Code:
PROXY_LIST = ['1.10.240.135:8080',
'101.109.142.5:8080',
'177.124.16.178:45817',
'101.109.110.221:8080']

with:
Code:
    file = open(path, "r")
    for line in file:
    print(line, end="")

makes it easier to store bigger numbers of proxies Smile.
(This post was last modified: 07-01-2019, 04:48 AM by Leviathan.)

Reply

RE: Python Proxy Switcher basic tutorial #7
(07-01-2019, 04:39 AM)Leviathan Wrote: @Sartux you could add something like this:

Add to top of the code:
Code:
path = 'list.txt'

Replace:
Code:
PROXY_LIST = ['1.10.240.135:8080',
'101.109.142.5:8080',
'177.124.16.178:45817',
'101.109.110.221:8080']

with:
Code:
    file = open(path, "r")
    for line in file:
    print(line, end="")

makes it easier to store bigger numbers of proxies Smile.

Yes it's a good way to add more - I made this as simple as possible so people could learn but there's much more they could do (like threading, capturing lag etc.) if they wanted to.

[+] 1 user Likes Sartux's post
Reply

RE: Python Proxy Switcher basic tutorial #8
Quote:Yes it's a good way to add more - I made this as simple as possible so people could learn but there's much more they could do (like threading, capturing lag etc.)  if they wanted to.

Yeah that's true as well, just thought about it since people probably just copy & paste it anyways so yeh

Reply






Users browsing this thread: 1 Guest(s)