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
It is recommended that you set the environment variable AUDIUS_APP_NAME prior to using the SDK:
export AUDIUS_APP_NAME="My_Audius_App"
You can also specify an app name when creating the SDK, like:
from audius.sdk import Audius
sdk = Audius(app="my_app")
If you don't specify an app name, the default name audius-py
will be used.
Additionally, specify your host URL via environment variable:
export AUDIUS_HOST_NAME="https://audius.example.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 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
Built Distribution
File details
Details for the file audius-py-0.1.2.tar.gz
.
File metadata
- Download URL: audius-py-0.1.2.tar.gz
- Upload date:
- Size: 14.5 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.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85b7d4b81a6fd7b2c94fb2260c6f34fb127712a2314066f06c764855332515ea |
|
MD5 | 9c00451c97fd5ef89528bcd05b614823 |
|
BLAKE2b-256 | 53966aff70d734cfb02d9a23e97ff8d5da573559c3337e7d5d52672fb4893f13 |
File details
Details for the file audius_py-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: audius_py-0.1.2-py3-none-any.whl
- Upload date:
- Size: 14.3 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.0.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7dd38dbfd41ca590511547b0f82f3737b0dfb8d203b65e7ebdc99b94b7cc1b2c |
|
MD5 | 546e648c35784f90d5a2a72d9147b9b9 |
|
BLAKE2b-256 | a7db8058864cb6fed6a1eff8d0d4677f490fe7134c0a4e5c871dbf30b15a6cbc |