Comments (9)
def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()
job_thread.join()
run_threaded(job_func)
from hcaptcha-challenger.
if "win" in sys.platform:
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(ImageDownloader(docker=docker_).subvert(workers="fast"))
else:
loop = asyncio.get_event_loop()
loop.run_until_complete(
ImageDownloader(docker=docker_).subvert(workers="fast")
)
from hcaptcha-challenger.
Hello, I just wondered if you had any plans to enable multi threading for this. For my custom use case, it seems that the "Image Downloader" makes this incompatible due to the asyncio loop structure. Unfortunately, I do not have the skills to modify this myself and was left wondering if this could be a useful feature for other people too.
from hcaptcha-challenger.
For my custom use case, it seems that the "Image Downloader" makes this incompatible due to the asyncio loop structure.
?👀
from hcaptcha-challenger.
For my custom use case, it seems that the "Image Downloader" makes this incompatible due to the asyncio loop structure.
?👀
For example, when I try the captcha challenge in a function, such as the following:
def run_threaded(job_func):
job_thread = threading.Thread(target=job_func)
job_thread.start()
run_threaded(job_func)
I receive the following error: "RuntimeError: There is no current event loop in thread 'Thread-2 (job_func)".
I tried the following for ImageDownloader()
instead, but it was then not downloading the images:
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
loop.run_until_complete(downloader.subvert(workers="fast"))
Apologize for my lack of experience but hopefully you understand :)
from hcaptcha-challenger.
def run_threaded(job_func): job_thread = threading.Thread(target=job_func) job_thread.start() job_thread.join() run_threaded(job_func)
if "win" in sys.platform: asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) asyncio.run(ImageDownloader(docker=docker_).subvert(workers="fast")) else: loop = asyncio.get_event_loop() loop.run_until_complete( ImageDownloader(docker=docker_).subvert(workers="fast") )
Thank you so much for taking the time to look at this for me. Your examples work well and I am able to run the function in a thread now. Unfortunately, my goal doesn't seem possible. I was hoping to be able to run multiple threads simultaneously which is why I never used job_thread.join()
in my previous code.
from hcaptcha-challenger.
我认为有多种方案可以实现你所谓的“异步协同”,此外,使用“协程异步”替代“线程异步”能在这类场景中争取到更多的资源利用率。但为了避免所谓的“滥用”我觉得我不能至少不应该在这种场合将“高性能”的并发方案公之于众。如果你想在你自己的项目中使用 hcaptcha-challenger 你应该知道怎么修改代码。
from hcaptcha-challenger.
我认为有多种方案可以实现你所谓的“异步协同”,此外,使用“协程异步”替代“线程异步”能在这类场景中争取到更多的资源利用率。但为了避免所谓的“滥用”我觉得我不能至少不应该在这种场合将“高性能”的并发方案公之于众。如果你想在你自己的项目中使用 hcaptcha-challenger 你应该知道怎么修改代码。
Thank you for your response. I understand what you mean, unfortunately since this is out of my scope I think I'll have to wait until I have further knowledge of Python. None the less, I appreciate you taking the time to reply.
from hcaptcha-challenger.
@GoldDust69 纸上得来终觉浅 绝知此事要躬行
from hcaptcha-challenger.
Related Issues (20)
- [Challenge] [retrain] please click on the most similar object to the following reference shape
- [Challenge] [retrain] Please click on the object that appears only once
- feat(components): zero-shot object detection
- feat(control): nested CLIP candidates
- Can you give me an example code on using hcaptcha-challenger with selenium
- [Question] The project is failing 90% of the time because of new challenges HOT 15
- [Challenge] Please find and click on the letter K/W in the image below.
- [Challenge] Pleasae click at the star
- [Challenge] Please click each image containing a bumblebee
- Browserless Challenges HOT 1
- Solved
- google colab error
- url 'https://api.hcaptcha.com/getcaptcha/' returning base64 instead json HOT 9
- bug: workflow post-action
- feat(new-order): Integrated with LVM (large visual models) HOT 1
- [Challenge]
- feat(cloudflare-edge-node): FastAPI Python Workers
- feat(schema): Estimate Bottle Orientation with Computer Vision
- Solving captcha on queries
- use playwright dmmo question HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hcaptcha-challenger.