Код на второй итерации вызывает ошибку 429 Too Many Requests. Есть идеи как этого избежать?

ZeroTolerance

Новичок
Пользователь
Мар 14, 2021
1
0
1
  1. Windows 10
  2. Python 3.8.5
  3. ----------------- -----------
    aiohttp 3.7.4.post0
    async-timeout 3.0.1
    attrs 20.2.0
    autobahn 20.7.1
    Automat 20.2.0
    base58 2.1.0
    bitarray 1.2.2
    certifi 2020.6.20
    cffi 1.14.3
    chardet 3.0.4
    constantly 15.1.0
    cryptography 3.1.1
    cytoolz 0.11.0
    dateparser 0.7.6
    eth-abi 2.1.1
    eth-account 0.5.4
    eth-hash 0.3.1
    eth-keyfile 0.5.1
    eth-keys 0.3.3
    eth-rlp 0.2.1
    eth-typing 2.2.2
    eth-utils 1.10.0
    gevent 21.1.2
    greenlet 1.0.0
    grequests 0.6.0
    h11 0.12.0
    hexbytes 0.2.1
    httpcore 0.12.3
    httpx 0.17.0
    hyperlink 20.0.1
    idna 2.10
    incremental 17.5.0
    ipfshttpclient 0.7.0a1
    jsonschema 3.2.0
    lru-dict 1.1.7
    multiaddr 0.0.9
    multidict 5.1.0
    netaddr 0.8.0
    numpy 1.19.2
    parsimonious 0.8.1
    Pillow 7.2.0
    pip 21.0.1
    protobuf 3.15.5
    pyasn1 0.4.8
    pyasn1-modules 0.2.8
    pycparser 2.20
    pycryptodome 3.10.1
    PyHamcrest 2.0.2
    pyOpenSSL 19.1.0
    pyperclip3 0.4.1
    pypiwin32 223
    pyrsistent 0.17.3
    python-binance 0.7.5
    python-dateutil 2.8.1
    pytz 2020.1
    pywin32 300
    ratelimit 2.2.1
    regex 2020.9.27
    requests 2.24.0
    requests-futures 1.0.0
    requests-threads 0.1.1
    rfc3986 1.4.0
    rlp 2.0.1
    service-identity 18.1.0
    setuptools 47.1.0
    simple-requests 1.1.1
    six 1.15.0
    sniffio 1.2.0
    toolz 0.11.1
    Twisted 20.3.0
    txaio 20.4.1
    typing-extensions 3.7.4.3
    tzlocal 2.1
    urllib3 1.25.10
    varint 1.0.2
    web3 5.17.0
    websockets 8.1
    wxPython 4.1.0
    yarl 1.6.3
    zope.event 4.5.0
    zope.interface 5.1.0


  4. Python:
    def xecutor():
        with concurrent.futures.ThreadPoolExecutor(max_workers=20) as executor:
            future_to_url = {executor.submit(load_url, url, 10): url for url in get_urls()}
            for future in concurrent.futures.as_completed(future_to_url):
                url = future_to_url[future]
                req2 = future.result()
                data2 = req2.json()
                req_urlsJSON.append(data2)
    
                if req2.status_code != 200:
                    raise Exception('API response: {}'.format(req2.status_code))
        return req_urlsJSON
        
    for i in range(3):
        xecutor()
 

Форум IT Специалистов