Indexer _ expected string or bytes-like object

Hello everyone, I’m trying to use the indexer for the first time, leaning on pure stake as a node.

Whenever I try to get information from the indexer I always get the error like:

expected string or bytes-like object

would someone be able to explain to me why?
Yet everything seems to me to be done correctly, I followed the examples but it doesn’t work.
Below I am attaching my code:

import os
import json
from time import sleep
from datetime import timezone


from algosdk.v2client import indexer


algod_address = "https://testnet-algorand.api.purestake.io/ps2"
algod_token = {
              "X-API-Key":   "0NOBr3mJZZf9Atu9EzEbaSdwBSv0Bzl1xqEApaNj"
}

indexer_client = indexer.IndexerClient(algod_token, algod_address, headers=None)


def get_txn_response(min_amount, limit):

  nexttoken = ""
  amount = min_amount
  lim = limit
  numtx = 1

  responses = []

  while numtx > 0 :
    response = indexer_client.search_transactions(amount,lim)

  transactions = response['transactions']
  responses += transactions

  numtx = len(transactions)

  if (numtx > 0):
        nexttoken = response['next-token']
        # Pretty Printing JSON string 

  return responses 

am = 10
lm = 5

get_txn_response(am,lm)
print("Tranastion Info: " + json.dumps(responses, indent=2, sort_keys=True))

every time the program enters the indexer_client.search_transactions method, I get that result.
Thanks to anyone willing to help me!

The URL for Indexer has a different path it’s idx2 - https://testnet-algorand.api.purestake.io/idx2

Also, please remove the API key from your post.