Giter Site home page Giter Site logo

nickdelnano / spotipy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spotipy-dev/spotipy

0.0 1.0 0.0 1.63 MB

A Python library for the Spotify Web API; forked to add MySQL integration

Home Page: http://spotipy.readthedocs.org/

License: MIT License

Python 100.00%

spotipy's Introduction

ndelnano-spotipy - a Python client for The Spotify Web API, which fetches and saves OAuth tokens in MySQL.

pip install ndelnano-spotipy

Description

ndelnano-spotipy is a fork of spotipy, which is a thin client library for the Spotify Web API.

Differences in this fork!

Currently two things:

  • Batching data to endpoints used in the recently-played-playlists. So far these endpoints include: checking saved tracks in user library, adding tracks to a user's playlist. There is likely more to come as that project progresses.
  • Support for refreshing and storing user's OAuth tokens in MySQL. When an API call fails due to an expired token, ndelnano-spotipy refreshed the token, stores the new token in MySQL, and retries. See the schema of recently-played-playlists in its root directory.

To get started:

def get_spotify_client_for_username(username):
    credentials = SpotifyClientCredentials(
        username,
        db_creds=db.db.get_db_creds(),
        spotify_app_creds=get_spotify_app_creds()
    )

return spotipy.Spotify(client_credentials_manager=credentials)

All you need is the username UNIQUE KEY from the users table to get an API client!

db_creds - dict of form: { 'DB_HOST' : '', 'DB_USER' : '', 'DB_PASS' : '', 'DB_NAME' : '' }

spotify_app_creds - dict of form: { 'SPOTIFY_CLIENT_ID' : '', 'SPOTIFY_CLIENT_SECRET : '' } These are credentials from your Spotify developer application.


## Documentation

Spotipy's full documentation is online at [Spotipy Documentation](http://spotipy.readthedocs.org/).


## Installation
If you already have [Python](http://www.python.org/) on your system you can install the library simply by downloading the distribution, unpack it and install in the usual fashion:

```bash
python setup.py install

You can also install it using a popular package manager with

pip install ndelnano_spotipy

or

easy_install ndelnano_spotipy

Dependencies

  • Requests - ndelnano_spotipy requires the requests package to be installed

Quick Start

To get started, simply install spotipy, create a Spotify object and call methods:

import spotipy
sp = spotipy.Spotify()

results = sp.search(q='weezer', limit=20)
for i, t in enumerate(results['tracks']['items']):
    print ' ', i, t['name']

A full set of examples can be found in the online documentation and in the Spotipy examples directory.

Reporting Issues

If you have suggestions, bugs or other issues specific to this library, file them here. Or just send me a pull request.

Version

TODO when official release is ready

spotipy's People

Contributors

akx avatar arska avatar baschdl avatar carlosedp avatar cory-weiner avatar delucks avatar eugenio412 avatar felipeumanzor avatar happyleavesaoc avatar hughrawlinson avatar hugovk avatar jmperez avatar jsundram avatar kevinmgranger avatar liychristopher avatar mattduck avatar mbirtwell avatar mkanespotify avatar nathancoleman avatar nathancoleman-wf avatar ncordon avatar nickdelnano avatar plamere avatar rcompton avatar ryankicks avatar shantanugoel avatar sharkone avatar tdhooper avatar thelinmichael avatar zhuwxyz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.