# audius-py
A Python SDK and CLI for the Audius Platform.
## Installation
From pip:
```shell
pip install audius-py
```
From source (from the root project directory):
```shell
pip install .
```
**NOTE**: In order to user the media player functionality of the SDK, you must have [VLC media player](https://www.videolan.org/vlc/) installed.
## Quick Usage
To create an `audius` SDK instance, do:
```python
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:
```shell
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:
```python
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.:
```shell
export AUDIUS_HOST_NAME="https://audius.example.com"
```
or:
```python
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:
```shell
audius hosts
```
### CLI
See all commands by doing:
```shell
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:
```shell
audius users top
```
It should show output like this:
```shell
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:
```shell
audius users tracks eAZl3
```
It should output track information like this:
```shell
Track: Kliptown Empyrean (id=G0wyE)
```
Finally, play the track by using its ID in the following command:
```shell
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:
```shell
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:
```shell
audius tracks play G0wyE --player vlc
```
### Python SDK
Use the Python SDK directly:
```python
from audius.sdk import Audius
sdk = Audius(app="my_app")
for artist in sdk.users.top():
print(artist["name"])
```
Raw data
{
"_id": null,
"home_page": "https://github.com/unparalleled-js/audius-py",
"name": "audius-py",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9,<4",
"maintainer_email": "",
"keywords": "audius",
"author": "Juliya Smith <juliya@juliyasmith.com>",
"author_email": "juliya@juliyasmith.com",
"download_url": "https://files.pythonhosted.org/packages/be/94/879cc85884ad8f1dc4926d04bdfe566bac08f9847ae50659c40c2f34affa/audius-py-0.1.5.tar.gz",
"platform": null,
"description": "# audius-py\n\nA Python SDK and CLI for the Audius Platform.\n\n## Installation\n\nFrom pip:\n\n```shell\npip install audius-py\n```\n\nFrom source (from the root project directory):\n\n```shell\npip install .\n```\n\n**NOTE**: In order to user the media player functionality of the SDK, you must have [VLC media player](https://www.videolan.org/vlc/) installed.\n\n## Quick Usage\n\nTo create an `audius` SDK instance, do:\n\n```python\nfrom audius.sdk import Audius\n\naudius = Audius()\n```\n\nIt is recommended that you set a custom app name (the default is `audius-py`).\nOne way to do this is via an environment variable:\n\n```shell\nexport AUDIUS_APP_NAME=\"My_Audius_App\"\n```\n\nThen, when you create an Audius SDK object, it will automatically use this value instead.\n\nYou can also specify an app name (and other configuration) when creating the SDK, like:\n\n```python\nfrom audius.config import Config\nfrom audius.sdk import Audius\n\nconfig = Config(app_name=\"my_app\")\nsdk = Audius(config=config)\n```\n\nAnother example config value is the host, e.g.:\n\n```shell\nexport AUDIUS_HOST_NAME=\"https://audius.example.com\"\n```\n\nor:\n\n```python\nfrom audius.config import Config\n\nConfig(host=\"https://audius.exmaple.com\")\n```\n\nIf you don't specify a host, `audius-py` will select a random host from the list of known hosts to the Audius app.\nTo see all available hosts, run the following command:\n\n```shell\naudius hosts\n```\n\n### CLI\n\nSee all commands by doing:\n\n```shell\naudius --help\n```\n\nThis guide will show how to stream one of the top songs on Audius directly into your terminal.\nFirst, browse top artists using the CLI:\n\n```shell\naudius users top\n```\n\nIt should show output like this:\n\n```shell\n1: Zedd (id=XlJby)\n2: Skrillex (id=eAZl3)\n3: Aluna (id=5j9VM)\n4: kennybeats (id=DrZwG)\n5: trillsammy (id=NzMW8)\n6: ODESZA (id=2oNg1)\n7: noodles (id=b9w8J)\n8: kayzo (id=LMdyZ)\n9: Disclosure (id=E2O1R)\n10: Fat Nick (id=oGKZd)\n```\n\nNext, select one of the user IDs by copying it and using it in the following command:\n\n```shell\naudius users tracks eAZl3\n```\n\nIt should output track information like this:\n\n```shell\nTrack: Kliptown Empyrean (id=G0wyE)\n```\n\nFinally, play the track by using its ID in the following command:\n\n```shell\naudius tracks play G0wyE\n```\n\nThe song should now be streaming into your terminal!\nAnd if you really enjoy the track, you can download it by doing:\n\n```shell\naudius tracks download G0wyE song.mp3\n```\n\nBy default, `audius-py` tries to find the best player.\nHowever, specify your player of choice using the `--player` flag:\n\n```shell\naudius tracks play G0wyE --player vlc\n```\n\n### Python SDK\n\nUse the Python SDK directly:\n\n```python\nfrom audius.sdk import Audius\n\nsdk = Audius(app=\"my_app\")\nfor artist in sdk.users.top():\n print(artist[\"name\"])\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Interact with the Audius platform in Python and the terminal",
"version": "0.1.5",
"split_keywords": [
"audius"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "abea752e6f0a34f8e56b174648683f0b472af78062cce0eefd6510f643eda4c3",
"md5": "8da3dc3a7fae090231dac78cd03747e5",
"sha256": "310ff2e58ac1665c85551388e353a2d1f02a67b039d8aef1635e2b36258f14e2"
},
"downloads": -1,
"filename": "audius_py-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8da3dc3a7fae090231dac78cd03747e5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9,<4",
"size": 19348,
"upload_time": "2023-04-08T18:26:59",
"upload_time_iso_8601": "2023-04-08T18:26:59.726288Z",
"url": "https://files.pythonhosted.org/packages/ab/ea/752e6f0a34f8e56b174648683f0b472af78062cce0eefd6510f643eda4c3/audius_py-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "be94879cc85884ad8f1dc4926d04bdfe566bac08f9847ae50659c40c2f34affa",
"md5": "030682fdb8bbc4cecf35ab5d8ed5fbd9",
"sha256": "1b8f94b9566329105f7b18998e99ee4884865181d6751887c6e24d0d8bb8b739"
},
"downloads": -1,
"filename": "audius-py-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "030682fdb8bbc4cecf35ab5d8ed5fbd9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9,<4",
"size": 18514,
"upload_time": "2023-04-08T18:27:01",
"upload_time_iso_8601": "2023-04-08T18:27:01.493518Z",
"url": "https://files.pythonhosted.org/packages/be/94/879cc85884ad8f1dc4926d04bdfe566bac08f9847ae50659c40c2f34affa/audius-py-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-08 18:27:01",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "unparalleled-js",
"github_project": "audius-py",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "audius-py"
}