Issue with Web3 API Python SDK

When Querying data using the Web3 API Python SDK I always get a result of none.

  • Have tested with the link token address which is in the script below
  • Tools already installed as required in the Readme file
  • Python Script As Follows:
from __future__ import print_function
import time
import swagger_client
from import ApiException
from pprint import pprint

# Configure API key authorization: ApiKeyAuth
configuration = swagger_client.Configuration()
configuration.api_key['X-API-Key'] = ''
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['X-API-Key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.TokenApi(swagger_client.ApiClient(configuration))
token_address = '0x514910771af9ca656af840dff83e8264ecf986ca' # str | Address of the contract
chain = 'eth' # str | The chain to query (optional) (default to eth)
chain_name = 'mainnet' # str | The chain name to query (optional) (default to mainnet)
format = 'decimal' # str | The format of the token id (optional) (default to decimal)
offset = 56 # int | offset (optional)
limit = 56 # int | limit (optional)
order = 'name.DESC' # str | The field(s) to order on and if it should be ordered in ascending or descending order. Specified by: fieldName1.order,fieldName2.order. Example 1: \"name\", \"name.ASC\", \"name.DESC\", Example 2: \"Name and Symbol\", \"name.ASC,symbol.DESC\" (optional)

    # Gets the owners of the NFTs of a given contract
    api_response = api_instance.get_token_price(token_address)
except ApiException as e:
    print("Exception when calling API: %s\n" % e)


1 Like

Hey @Daniel

I just tested your code with my X-API-KEY. And it works correctly:

Please share your logs :man_factory_worker:

Hi Yomoo,

Thank you for your response, sorry, I was a bit busy and didn’t have time to respond.
I actually built a client manually, the API itself rocks. But not sure why I cannot work with the SDK client.

All I get is the following.

I don’t really get any error only a None response.

I think my pip freeze reflects all the proper requirements.


Thank you very much.



Python 2.7 and 3.4+

Which version of python do you have?
Outside the SDK api, are requests processed normally? For example from the interactive documentation?
If not, send me in DM your X-API-KEY

Hi Yomoo.

My Python for that environment is 3.9.5 which I think fulfills the required 3.4 and above.I think with homebrew I can go back as far as 3.7.x. Which one were you using?

The X-API-KEY works in both the Swagger docs and also in the client I built from the scratch. I’m having problems only with the SDK.

Best Regards