HonestHook

RankingsSign in

Tutorials

SoundCloud profile in Python

One authenticated call to /api/v1/soundcloud/profile?handle=edsheeran, the response it returned, and the line that reads one field out of it.

What you need

Standard library only — urllib and json ship with Python 3. There is nothing to pip install.

The call

import json
import os
import urllib.request

url = "https://honesthook.com/api/v1/soundcloud/profile?handle=edsheeran"

request = urllib.request.Request(
    url,
    headers={"Authorization": "Bearer " + os.environ["HH_KEY"]},
)

with urllib.request.urlopen(request, timeout=30) as response:
    envelope = json.load(response)

print(envelope["success"], envelope["platform"], envelope["endpoint"])

What came back

{
  "success": true,
  "platform": "soundcloud",
  "endpoint": "soundcloud/profile",
  "data": {
    "author": {
      "id": "3685019",
      "handle": "edsheeran",
      "name": "Ed Sheeran",
      "followers": 2977786,
      "following": 0,
      "posts_count": 466,
      "verified": true,
      "is_private": null
    }
  },
  "error": null,
  "cached": false
}

Recorded response, captured 27 Sep 2026. A live call returns the value at the moment you ask, not this one.

Every field in that capture

In PythonType in this capture
envelope["success"]boolean
envelope["platform"]string
envelope["endpoint"]string
envelope["data"]["author"]["id"]string
envelope["data"]["author"]["handle"]string
envelope["data"]["author"]["name"]string
envelope["data"]["author"]["followers"]number
envelope["data"]["author"]["following"]number
envelope["data"]["author"]["posts_count"]number
envelope["data"]["author"]["verified"]boolean
envelope["data"]["author"]["is_private"]null
envelope["error"]null
envelope["cached"]boolean

A field we cannot read comes back null, never 0. A zero would be a claim about the account; null is a fact about our collection.

Reading one field

print(envelope["data"]["author"]["followers"])

envelope is the dict from the block above. os.environ raises if the key is not set, which is better than sending the word None as a bearer token.

SoundCloud embeds real JSON in its page, which sounds like the easy case. It is not, because that block contains several counters and two of them are one letter apart: followers_count and followings_count.

On the account used for the capture below, the wrong one of those two reads zero. Pick it and you publish a well-known artist with no followers — valid JSON, no error, a number that is simply false.

Why that matters to you even though you make one call

You do not touch the hydration block. You send one request. But the reason to hand this over is precisely that class of bug: it does not announce itself. The response parses, the type is right, the field exists, and the value is wrong. Nothing in your code can tell.

This endpoint takes the field whose name matches the thing being counted.

What you are calling

One authenticated GET to our endpoint, with your key in an Authorization header. The handle in the example is the one that produced the recorded response below.

Before you copy the block

Keep the key in an environment variable — all three examples read HH_KEY.

Plays and likes are per track, not per profile, and this endpoint answers about the profile.

The endpoint itself

Parameters, the handle format and what a call costs: soundcloud-api/profile.

The same call in curl · JavaScript.

Free key, 1,000 credits a month

Every example above runs against the real endpoint as soon as you have a key. No card, and the key arrives in seconds.

Get a key →

← Tutorials · soundcloud-api · Pricing