# Indexer \_ expected string or bytes-like object

**URL:** <https://forum.algorand.co/t/indexer-expected-string-or-bytes-like-object/4546>\
**Category:** General\
**Tags:** testnet\
**Created:** [October 14, 2021, 11:11am UTC](https://forum.algorand.co/t/indexer-expected-string-or-bytes-like-object/4546 "2021-10-14T11:11:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![simospa](https://avatars.discourse-cdn.com/v4/letter/s/bc79bd/32.png) [@simospa](https://forum.algorand.co/u/simospa)\
**Post date:** [October 14, 2021, 11:11am UTC](https://forum.algorand.co/t/indexer-expected-string-or-bytes-like-object/4546/1 "2021-10-14T11:11:00Z")

</div>

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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![Tim](https://avatars.discourse-cdn.com/v4/letter/t/ce73a5/32.png) [@Tim](https://forum.algorand.co/u/Tim)\
**Post date:** [October 15, 2021, 2:55pm UTC](https://forum.algorand.co/t/indexer-expected-string-or-bytes-like-object/4546/2 "2021-10-15T14:55:08Z")

</div>

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

Also, please remove the API key from your post.
