├── LICENSE ├── README.md └── __init__.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Venax 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > # PYPROXIES 2 | 3 | ``Please subscribe to my Github @venaxyt if you want more modules like this.``
4 | **Pyproxies only returns proxy, it does not print them like on screenshot.** 5 | 6 | ## Send a request with http proxy 7 | ``` 8 | http_proxy = pyproxies.proxy("http") 9 | proxy_ip = requests.get("https://api.ipify.org", proxies=http_proxy) 10 | print(f" [IP] : {http_proxy}") 11 | ``` 12 | ![http](https://user-images.githubusercontent.com/81310818/131668032-3ca5803c-f709-49bc-a243-b978f8293921.PNG) 13 | ## Send a request with socks4 proxy 14 | ``` 15 | socks4_proxy = pyproxies.proxy("socks4") 16 | proxy_ip = requests.get("https://api.ipify.org", proxies=socks4_proxy) 17 | print(f" [IP] : {socks4_proxy}") 18 | ``` 19 | ![socks4](https://user-images.githubusercontent.com/81310818/131668049-e8eb6e97-1fc8-46df-9222-e38450d1469b.PNG) 20 | ## Send a request with socks5 proxy 21 | ``` 22 | socks5_proxy = pyproxies.proxy("socks5") 23 | proxy_ip = requests.get("https://api.ipify.org", proxies=socks5_proxy) 24 | print(f" [IP] : {socks5_proxy}") 25 | ``` 26 | ![socks5](https://user-images.githubusercontent.com/81310818/131668046-1d9d3683-2a9f-41d0-a786-ac4428c24cdf.PNG) 27 | 28 | ## Informations: 29 | Pyproxies check every proxy it returns, by sending a request to "api.ipify.org", a website which returns requester ip adress. 30 | Pyproxies only returns valid proxies whose timeout is less than 10 seconds, you can edit the timeout in the module code. 31 | All proxies comes from proxyscrape.com, you can edit the proxies source in the module code too. 32 | Thanks for using my modules, @venaxyt.
33 | 34 | > ### Download : pip install pyproxies 35 | > ### Documentation : https://pypi.org/project/pyproxies 36 | -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | # Module made by @venaxyt on Github 2 | import requests, random 3 | 4 | def proxy(server, timeout = 5): 5 | working_proxy = False 6 | while not working_proxy: 7 | if server == "http": 8 | server_proxy_list = requests.get("https://api.proxyscrape.com/v2/?request=getproxies&protocol=http&timeout=1000&co").text 9 | elif server == "socks4": 10 | server_proxy_list = requests.get("https://api.proxyscrape.com/v2/?request=getproxies&protocol=socks4&timeout=1000&co").text 11 | elif server == "socks5": 12 | server_proxy_list = requests.get("https://api.proxyscrape.com/v2/?request=getproxies&protocol=socks5&timeout=1000&co").text 13 | else: 14 | raise Exception("Error : You only can use http, socks4 and socks5 proxies.") 15 | server_proxy = random.choice(server_proxy_list.splitlines()) 16 | proxy = {"https": f"{server}://{server_proxy}"} 17 | try: 18 | requests.get("https://api.ipify.org", proxies = proxy, timeout = timeout) 19 | working_proxy = True 20 | except: 21 | pass 22 | if working_proxy == True: 23 | return proxy 24 | --------------------------------------------------------------------------------