Skip to main content

Interact with the Audius platform in Python and the terminal

Project description

audius-py

A Python SDK and CLI for the Audius Platform.

Installation

From pip:

pip install audius-py

From source (from the root project directory):

pip install .

NOTE: In order to user the media player functionality of the SDK, you must have VLC media player installed.

Quick Usage

To create an audius SDK instance, do:

from audius.sdk import Audius

audius = Audius()

It is recommended that you set a custom app name (the default is audius-py). One way to do this is via an environment variable:

export AUDIUS_APP_NAME="My_Audius_App"

Then, when you create an Audius SDK object, it will automatically use this value instead.

You can also specify an app name (and other configuration) when creating the SDK, like:

from audius.config import Config
from audius.sdk import Audius

config = Config(app_name="my_app")
sdk = Audius(config=config)

Another example config value is the host, e.g.:

export AUDIUS_HOST_NAME="https://audius.example.com"

or:

from audius.config import Config

Config(host="https://audius.exmaple.com")

If you don't specify a host, audius-py will select a random host from the list of known hosts to the Audius app. To see all available hosts, run the following command:

audius hosts

CLI

See all commands by doing:

audius --help

This guide will show how to stream one of the top songs on Audius directly into your terminal. First, browse top artists using the CLI:

audius users top

It should show output like this:

1: Zedd (id=XlJby)
2: Skrillex (id=eAZl3)
3: Aluna (id=5j9VM)
4: kennybeats (id=DrZwG)
5: trillsammy (id=NzMW8)
6: ODESZA (id=2oNg1)
7: noodles (id=b9w8J)
8: kayzo (id=LMdyZ)
9: Disclosure (id=E2O1R)
10: Fat Nick (id=oGKZd)

Next, select one of the user IDs by copying it and using it in the following command:

audius users tracks eAZl3

It should output track information like this:

Track: Kliptown Empyrean (id=G0wyE)

Finally, play the track by using its ID in the following command:

audius tracks play G0wyE

The song should now be streaming into your terminal! And if you really enjoy the track, you can download it by doing:

audius tracks download G0wyE song.mp3

Python SDK

Use the Python SDK directly:

from audius.sdk import Audius

sdk = Audius(app="my_app")
for artist in sdk.users.top():
    print(artist["name"])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

audius-py-0.1.3.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

audius_py-0.1.3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file audius-py-0.1.3.tar.gz.

File metadata

  • Download URL: audius-py-0.1.3.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.65.0 importlib-metadata/6.1.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16

File hashes

Hashes for audius-py-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a0901cd1eb2e7f297082081e9975c9052e3106f6865fee475ef651135bcb1dea
MD5 dc811b0d493bd5f8f95e8ea9e6a86648
BLAKE2b-256 067c8079849d0323eebe19d4640345c746555a9041adeff437f70fd347f940d4

See more details on using hashes here.

File details

Details for the file audius_py-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: audius_py-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.28.2 requests-toolbelt/0.10.1 urllib3/1.26.15 tqdm/4.65.0 importlib-metadata/6.1.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16

File hashes

Hashes for audius_py-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 885f2f0d65be0918da5cbe7c41e76490662cea785540725cec5741b935d3355a
MD5 8301d9c1f8a55e2b640ba8217d703630
BLAKE2b-256 d2c106d7d5c8d6be229802f71254fc107688f4346a2024ef96d1be355ad1cc49

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page