import requests

API_KEY = '<TRUFFLEHOG_REDACTED_BSCSCAN>'

def is_verified_contract(contract_address):
    url = f'https://api.bscscan.com/api?module=contract&action=getsourcecode&address={contract_address}&apikey={API_KEY}'
    response = requests.get(url)

    if response.status_code == 200:
        data = response.json()

        if data['tatus'] == '1':
            contract_info = data['result'][0]
            if contract_info['SourceCode']:
                return True
    return False


def is_token_contract(contract_address):
    url = f'https://api.bscscan.com/api?module=token&action=getTokenInfo&contractaddress={contract_address}&apikey={API_KEY}'
    response = requests.get(url)

    if response.status_code == 200:
        data = response.json()

        if data['status'] == '1':
            return True
    return False


def get_verified_contracts_in_page(page, start_block, end_block):
    verified_contracts = []
    url = f'https://api.bscscan.com /api?module=account&action=tokentx&startblock={start_block}&endblock={end_block}&page={page}&offset=100&sort=desc&apikey={API_KEY}'

    response = requests.get(url, timeout=10)

    if response.status_code == 200:
        data = response.json()
        if data['status'] == '1':
            for tx in data['result']:
                contract_address = tx['contractAddress']
                if contract_address and contract_address not in verified_contracts:
                    if is_verified_contract(contract_address) and is_token_contract(contract_address):
                        verified_contracts.append(contract_address)
    return verified_contracts

def get_last_100_verified_contracts():
    start_block = 1
    end_block = 99999999
    num_contracts = 100
    contracts = []

    page = 1
    while len(contracts) < num_contracts:
        contracts_in_page = get_verified_contracts_in_page(page, start_block, end_block)
        contracts.extend(contracts_in_page)
        page += 1
    return contracts[:num_contracts]


# Call the function and display the addresses.
contracts = get_last_100_verified_contracts()
if contracts:
    print("Last 100 verified token contract addresses on the Binance Smart Chain network:")
    for c in contracts:
        print(c)
    else:
        print("No contracts found.")

This code throws an error. fix it

C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Scripts\python.exe C:\Users\AshotxXx\PycharmProjects\pythonProject13\main.py 
Traceback (most recent call last):
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connection.py", line 200, in _new_conn
    sock = connection.create_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\util\connection.py", line 60, in create_connection
    for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\AppData\Local\Programs\Python\Python311\Lib\socket.py", line 962, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno 11001] getaddrinfo failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen
    response = self._make_request(
               ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request
    raise new_e
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request
    self._validate_conn(conn)
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connectionpool.py", line 1092, in _validate_conn
    conn.connect()
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connection.py", line 604, in connect
    self.sock = sock = self._new_conn()
                       ^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connection.py", line 207, in _new_conn
    raise NameResolutionError(self.host, self, e) from e
urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x00000266B3111750>: Failed to resolve 'api.bscscan.com%20' ([Errno 11001] getaddrinfo failed)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\requests\adapters.py", line 486, in send
    resp = conn.urlopen(
           ^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen
    retries = retries.increment(
              ^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\urllib3\util\retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.bscscan.com%20', port=443): Max retries exceeded with url: /api?module=account&action=tokentx&startblock=1&endblock=99999999&page=1&offset=100&sort=desc&apikey=<TRUFFLEHOG_REDACTED_BSCSCAN> (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000266B3111750>: Failed to resolve 'api.bscscan.com%20' ([Errno 11001] getaddrinfo failed)"))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\main.py", line 62, in <module>
    contracts = get_last_100_verified_contracts()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\main.py", line 55, in get_last_100_verified_contracts
    contracts_in_page = get_verified_contracts_in_page(page, start_block, end_block)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\main.py", line 35, in get_verified_contracts_in_page
    response = requests.get(url, timeout=10)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\requests\api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\requests\sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\requests\sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\AshotxXx\PycharmProjects\pythonProject13\venv\Lib\site-packages\requests\adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.bscscan.com%20', port=443): Max retries exceeded with url: /api?module=account&action=tokentx&startblock=1&endblock=99999999&page=1&offset=100&sort=desc&apikey=<TRUFFLEHOG_REDACTED_BSCSCAN> (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x00000266B3111750>: Failed to resolve 'api.bscscan.com%20' ([Errno 11001] getaddrinfo failed)"))

Process finished with exit code 1