HSpotipy Docs

_images/hspotipy.jpeg

HaoSpotipy is a Python library for the Spotify Web API.

Note

Please start or watch this project on Github . We are writing up the documentation, please wait in patient.

User Guide

Installation

Step 1 : Spotipy

Spotipy is a lightweight Python library for the Spotify Web API. With Spotipy you get full access to all of the music data provided by the Spotify platform.

HSpotipy is build on top of Spotipy. More information and SDK please check here

Note

We highly suggest python3

pip install spotipy

Step 2 : Account

Before you start, you have to set up your account, register your application and prepare your environment. Please go to the next section Authorization and follow Web API Tutorial .

After that, you can create a local website to test your project.

Step 3 : Node JS

Authorization

Note

Before you use HSpotipy, you have to set up your web server by yourself. After that, your users can access your server and log in to their Spotify account.

All content in this section can be found in Web API Tutorial - Beginner’s Tutorial .

Step 1 : Create Spotify App

Please follow Web API Tutorial to set up your account, register your application, get your client ID and Secret Key and set up your local website via JaveScript.

Set up Account and Application
After registering your application, you can get and set your:
Try Web Service Environment
Mac OX Install node.js

Follow http://blog.teamtreehouse.com/install-node-js-npm-mac or simply enter:

Keep follow Web API Tutorial and Spotify Web API Authorization JaveScript Example to set up your web service environment.

Run OAuth example locally

Download OAuth examples, the code of the OAuth examples depends on the packages express,request and querystring. Download and install the dependencies running the following command.

To run the web example, open authorization_code/app.js, set the Client ID, Client ID and Redirect URL as http://localhost:8888/callback. .. code-block:: bash

cd authorization_code node app.js

Open http://localhost:8888 , the users can log in or sign up their account, just like how users do in Spotify website.

User can now get the oAuth info
  • Access token
  • Refresh token

Step 2: Python

Open Spotipy Authorized requests .

  • The Authorization Code flow This method is suitable for long-running applications which the user logs into once. It provides an access token that can be refreshed.
  • The Client Credentials flow The method makes it possible to authenticate your requests to the Spotify Web API and to obtain a higher rate limit than you would

Previous example just show how to use OAuth on web browser

API List

If you are looking for a specific function please check as below.

API - User

Developer, User and Spotify

  • developer : xxx
  • xx : xx
import spotipy

A

B

x

C