
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
An async Python interface to the Spotify API using aiohttp.
Note: This is alpha software. Use at your own risk.
To install, use pip:
python -m pip install aiohttp_spotify
It's best if you also install and use aiohttp-session.
To add the OAuth flow to your app:
from aiohttp import web
import aiohttp_spotify
async def handle_auth(request: web.Request, auth: aiohttp_spotify.SpotifyAuth):
# Store the `auth` object for use later
app = web.Application()
app["spotify_app"] = aiohttp_spotify.spotify_app(
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
redirect_uri=REDIRECT_URI,
handle_auth=handle_auth,
)
app.add_subapp("/spotify", app["spotify_app"])
Then you can make calls to the API as follows:
from aiohttp import ClientSession
async def call_api(request: web.Request) -> web.Response:
async with ClientSession() as session:
response = app["spotify_app"]["spotify_client"].request(
session, auth, "/me"
)
# The auth object will be updated as tokens expire so you should
# update this however you have it stored:
if response.auth_changed:
await handle_auth(request, response.auth)
return web.json_request(response.json())
where auth
is the SpotifyAuth
object from above.
Take a look at the demo directory for a more complete example.
FAQs
An async Python interface to the Spotify API using aiohttp
We found that aiohttp-spotify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.