Coder Social home page Coder Social logo

python-lastfm's Introduction

Last Fm

Name

lastfm

Description

Lastfm API library written in Python. Implements Lastfm API methods as described in its documentation You can use this library for Web/Desktop aplications. All the requests are using JSON as response format, just because xml is boring :) enjoy the library!

Usage

Authentication

Get user authentication
from lastfm.src.auth import Auth

# Creates an Auth object not authenticated
auth = Auth()
# generate and returns the url tha you have redirect the 
# user to give permission to your application
auth_url = auth.get_auth_url()

# if the user user give permission to your application, you can
# retrieves his session key
session = auth.get_session()

# You should store this session variable. It will be used to 
# compose all the authenticated requests to the Last FM API
User already authenticated
from lastfm.src.auth import Auth

# Creates an Auth object authenticated
stored_session = "19c246aa7ebf5d60ezdv6ae33d5c9d0x"
auth = Auth(stored_session)

Requests

Get an artist full information
from lastfm.src.artist import Artist

# Creates an Artist object by its name
artist = Artist("the strokes")

# retrieves artist information
info = artist.get_info()

Authenticated Requests

Gets an Artist tags from user
from lastfm.src.auth import Auth
from lastfm.src.artist import Artist

auth = Auth(stored_session)
artist = Artist("the strokes")

# every authenticated requests you should pass your Auth object 
# than the library makes the magic for you signing the request
tags = artist.get_tags(auth=auth)

Development Status

    The current Library only implements the Artists methods from the
Last FM API. It's under development, so if you want to contribute, fork me :)

Contributions

    The library was written using Test Driven Development. If you want to 
contribute, make shure your code pass on all tests and in the new tests that 
you could create. 
    Read the DEPENDENCIES file to see wich test libs are used to validate 
the code. 
    During the development, use the Makefile. Inside it, there are rules to 
validate the python code with pep8 and pylint tools as well as test rules that
will run tests for an especific module (artist, auth, etc).
    Create a file named secrets.py where you gonna put your session variable. It 
will be used by the tests to run authenticated request: 
# -*- coding: utf-8 -*-
mysession = "21c846aa7abf3c6fead46ae43d549dd0"
    If will be necessary to add new python libraries to the code, do not forget 
to add it to requirements.txt file
    Enjoy coding \o/

Author

Written by Gustavo Pantuza

Reporting Bugs

Report lastfm bugs to [email protected]

python-lastfm's People

Contributors

pantuza avatar

Watchers

 avatar  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.