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
Play a random song from Audius!
audius play
In-Depth Usage
To create an audius SDK instance, do:
from audius import Audius
audius = Audius()
It is recommended that you set a custom app name (the default is audius-py).
audius = Audius("My_Audius_App")
You can also use an environment:
export AUDIUS_APP_NAME="My_Audius_App"
And when you initialize without any arguments like Audius(), it will use the environment variable.
You can also specify a Config option where you can set more config than app_name:
from audius.config import Config
from audius.sdk import Audius
config = Config(app_name="my_app", host="https://audius.example.com")
sdk = Audius(config)
The Audius host name is also configurable as an environment variable:
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
By default, audius-py tries to find the best player.
However, specify your player of choice using the --player flag:
audius tracks play G0wyE --player vlc
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"])
Metadata
Release files for audius-py 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| audius-py-0.1.6.tar.gz | 18.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| audius_py-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.8 kB
Release files / audius-py-0.1.6.tar.gz
| Download URL | audius-py-0.1.6.tar.gz |
|---|---|
| Size | 18.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7526965871ad388e4985c0d473db5b7e5e493965a56cdd39720e9419d1e89ca8
|
|
BLAKE2b-256 checksum How to use checksums |
942a41ad6bcb43130d1b5b0df60d53c385690bb845f624451c4af0cb78834e74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.12.0 readme-renderer/44.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.3.0 tqdm/4.67.1 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.16
|
Release files / audius_py-0.1.6-py3-none-any.whl
| Download URL | audius_py-0.1.6-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
75ddf93b9ca1aea044d86a2ec625bf7ff8a2470be72650680c033cbf9c4a2c91
|
|
BLAKE2b-256 checksum How to use checksums |
434ed4fac1812dec7a00425b7ea217ba7ee460c6d3c4432afac1bbfe10f6b966
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.12.0 readme-renderer/44.0 requests/2.32.3 requests-toolbelt/1.0.0 urllib3/2.3.0 tqdm/4.67.1 importlib-metadata/8.6.1 keyring/25.6.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.16
|