Lars Basic GeniusAPI GET request (search lyrics)

Created by Lars last modified
import httplib, urllib, json,  random, sys

def getData(auth_string):
    conn = httplib.HTTPSConnection("")
    request_uri = "/search/lyrics?q=You%20only%20get%20one%20shot" 
    headersMap = {
            "User-Agent": "CompuServe Classic/1.22",
            "Accept": "application/json",
            "Authorization": "Bearer " + auth_string
    conn.request("GET", request_uri, headers=headersMap)
    response = conn.getresponse()
    ### Output the HTTP status code and reason text...
    print response.status, response.reason
    data =
    result = json.loads(data)

    print json.dumps(result, indent=4, sort_keys=True)

getData("<Auth token here>")

Comments (0)