Anchor Connector for Podcast Data
Project description
Anchor Connector
This is a simple library for connecting to the unofficial Anchor API.
It can be used to export data from your dashboard at
https://anchor.fm/dashboard.
Supported Endpoints
total_playsplays_by_age_rangeplays_by_appplays_by_deviceplays_by_episodeplays_by_genderplays_by_geoplays_by_geo_cityepisodes
For each episode, the following endpoints are supported:
episode_playsepisode_performanceepisode_aggregated_performanceepisode_all_time_video_data
See __main.py__ for all endpoints.
Credentials
Before you can use the library, you must extract your Anchor credentials from the dashboard; they are not exposed through your Anchor settings.
You can use our web-extension for that or take a look at the code to see how to do it manually.
Installation
pip install anchorconnector
Usage as a library
from anchorconnector import AnchorConnector
connector = AnchorConnector(
base_url=BASE_URL,
webstation_id=WEBSTATION_ID,
anchorpw_s=ANCHOR_PW_S,
)
end = datetime.now()
start = end - timedelta(days=30)
total_plays = connector.total_plays(True)
logger.info("Podcast Total Plays = {}", json.dumps(total_plays, indent=4))
plays_by_age_range = connector.plays_by_age_range(start, end)
logger.info(
"Plays by Age Range = {}",
json.dumps(plays_by_age_range, indent=4),
)
# plays_by_app = connector.plays_by_app(start, end)
# plays_by_device = connector.plays_by_device(start, end)
# plays_by_episode = connector.plays_by_episode(start, end)
# plays_by_gender = connector.plays_by_gender(start, end)
# plays_by_geo = connector.plays_by_geo()
# plays_by_geo_city = connector.plays_by_geo_city("Germany")
# ...
for episode in connector.episodes():
logger.info("Episode = {}", json.dumps(episode, indent=4))
web_episode_id = episode["webEpisodeId"]
episode_meta = connector.episode_plays(web_episode_id)
logger.info("Episode Metadata = {}", json.dumps(episode_meta, indent=4))
# ...
See __main.py__ for all endpoints.
Development
We use Pipenv for virtualenv and dev dependency management. With Pipenv installed:
- Install your locally checked out code in development mode, including its dependencies, and all dev dependencies into a virtual environment:
pipenv sync --dev
- Create an environment file and fill in the required values:
cp .env.sample .env
- Run the script in the virtual environment, which will automatically load
your
.env:
pipenv run anchorconnector
To add a new dependency for use during the development of this library:
pipenv install --dev $package
To add a new dependency necessary for the correct operation of this library, add
the package to the install_requires section of ./setup.py, then:
pipenv install
To publish the package:
python setup.py sdist bdist_wheel
twine upload dist/*
or
make publish
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anchorconnector-0.6.0.tar.gz.
File metadata
- Download URL: anchorconnector-0.6.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
feb049942355107a1ebce09d74970d485fa149593358873d857eb2016fa8d46d
|
|
| MD5 |
c8b3bea6bc6a47e756864b6a2e0f9a06
|
|
| BLAKE2b-256 |
5aa2cf8430f3e050648c76781b21f69e0fe0dc7a4423367017d973e6dc810735
|
File details
Details for the file anchorconnector-0.6.0-py3-none-any.whl.
File metadata
- Download URL: anchorconnector-0.6.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddcf9b0822d8b1a66e4f252992876b70a4610c3591cd834ccc8f38990f441dfa
|
|
| MD5 |
0549485eede69867d5735ff3ea6d04e1
|
|
| BLAKE2b-256 |
1a42d6572c45e2af07fb0bdeb4a81066d7552b931db94b28f2ab9f57baf37e8f
|