import asyncio
work_done = False
async def cursor():
try:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from threading import Thread, enumerate | |
def async_to_sync() -> asyncio.AbstractEventLoop: | |
loop = asyncio.new_event_loop() | |
Thread(target=loop.run_forever).start() | |
return loop | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
from playwright.sync_api import sync_playwright | |
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor | |
class Tls(threading.local): | |
def __init__(self) -> None: | |
self.playwright = sync_playwright().start() | |
print("Create playwright instance in Thread", threading.current_thread().name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import urlopen | |
import json | |
import toml | |
BASE_URL = "https://api.github.com/repos/python/cpython/pulls?per_page=1000&state=all" | |
def main(): | |
page = 1 | |
all_issues = [] | |
while page <= 10: | |
with urlopen(f"{BASE_URL}&page={page}") as response: |