Support Python 3.10, Revise the scenario on event loop
afunTW opened this issue · 8 comments
Summary
Due to another Python 3.10 deprecated warning, this will happen in the near future.
https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_event_loop
get_event_loop
checked the event loop and set a new one if not exist, but this will be an alias of get_running_loop
. We need the error handling on this.
For those new to python like me, you can follow this stack question to install an older version of python. Just don't symlink your version or uninstall python3. I tried.
I'm not sure what you're using. Maybe you're using the old proxybroker. I don't think pypi package for proxybroker2 has come out yet? In the meanwhile you can install it using the master branch
pip install git+https://github.com/bluet/proxybroker2
Just make sure you have git installed.
Hi @airone01
As @ziloka said, we are not on the public PyPI server since this is a fork project. So it might not be related to the Python version only.
Besides that, as a Python developer, I will recommend you to use some virtual environment tools (e.g. Poetry
) and a python version manager (e.g. pyenv). The isolation is important when it comes to contributing the open source in many different versions and dependencies.
Yeah just realised pyenv is a thing. I've been trying to install python 3.9.13 since a while now without success.
By the way does proxybroker2 use libssl1.0 ? I'm seeing a lot of certificates error when i use the docker image
Give some information about your python installation along with some screenshots for more information and maybe I can reproduce and find a solution
I'm getting these when using the docker image, not when compiling
I'm confused I'm new to python and I'm making chatgpt write all the code
Do I have to use proxybroker2 in the code instead of proxybroker
import asyncio
from proxybroker import Broker
async def show(proxies):
while True:
proxy = await proxies.get()
if proxy is None: break
if proxy.geo and proxy.geo.region == 'CA': # filter proxies by region (California)
print('Found proxy in %s, %s: %s' % (proxy.geo.city, proxy.geo.region, proxy.host))
proxies = asyncio.Queue()
broker = Broker(proxies)
tasks = asyncio.gather(
broker.find(types=['HTTP', 'HTTPS'], limit=10),
show(proxies))
loop = asyncio.get_event_loop()
loop.run_until_complete(tasks)
TypeError Traceback (most recent call last)
Cell In[5], line 13
11 proxies = asyncio.Queue()
12 loop = asyncio.get_event_loop()
---> 13 broker = Broker(proxies, loop=loop) # pass event loop to Broker constructor
14 tasks = asyncio.gather(
15 broker.find(types=['HTTP', 'HTTPS'], limit=10),
16 show(proxies))
18 loop.run_until_complete(tasks)
File c:\Users\Nesto\AppData\Local\Programs\Python\Python311\Lib\site-packages\proxybroker\api.py:97, in Broker.init(self, queue, timeout, max_conn, max_tries, judges, providers, verify_ssl, loop, **kwargs)
94 max_tries = attempts_conn
96 # The maximum number of concurrent checking proxies
---> 97 self._on_check = asyncio.Queue(maxsize=max_conn, loop=self._loop)
98 self._max_tries = max_tries
99 self._judges = judges
TypeError: Queue.init() got an unexpected keyword argument 'loop'
I'm confused I'm new to python and I'm making chatgpt write all the code
Please look at the examples folder for examples
Do I have to use proxybroker2 in the code instead of proxybroker
Yes?
Please ensure that you have properly installed this project.
Installing this dependency via poetry can be done by executing this command
poetry add git+https://github.com/bluet/proxybroker2