creativecommonsjson

Creative Commons JSON

Returns json instead of xml from creative commons api.

flask api that returns cc license depending on what licence is requested.

add svg/eps along with current png.

88x31 image currently - add 88x15 images.

add public domain/cc zero to the api

In [4]:
import requests
import json
import xmltodict

from flask import Flask, request
from flask_restful import Resource, Api
In [5]:
app = Flask(__name__)
In [6]:
api = Api(app)
In [7]:
@app.route('/')
def cclicence():
    memename = request.json.get('memename')

    return(requests.get('http://api.creativecommons.org/rest/dev/license/standard/get?commercial={}&derivatives=y'.format(request.args['commerical'])))
In [ ]:
@app.route('/cc', methods=['GET', 'POST'])
def query_example():
        if request.method == 'POST':  #this block is only entered when the form is submitted
            countrycode = request.form.get('countrycode')
            statecode = request.form.get('statecode')
            courtcode = request.form.get('courtcode')
            #<input type="radio" name="results" value="10" checked> 10<br>
            vslist = list()




            req = requests.get('http://www.austlii.edu.au/cgi-bin/feed/{}/cases/{}/{}/'.format(countrycode, statecode, courtcode))
            #req = requests.get('http://www.austlii.edu.au/cgi-bin/feed/au/cases/nsw/NSWSC/')
            bsreq = req.text
            xreq = xmltodict.parse(bsreq)
            lenchan = len(xreq['rss']['channel'])
            dalens = len(xreq['rss']['channel']['item'])

            for xr in range(0, dalens):
                #print(xreq['rss']['channel']['item'][xr])
                #print(xreq['rss']['channel']['item'][xr]['title'])
                #print(xreq['rss']['channel']['item'][xr]['link'])
                reqlink = xreq['rss']['channel']['item'][xr]['link']
                reqcourt = requests.get(reqlink)
                reqc = reqcourt.text
                soupcour = bs4.BeautifulSoup(reqc, 'lxml')
                courtit = soupcour.find('title')
                courtext = courtit.text

                repcourt = courtext.replace('[', ',')
                backcourt = repcourt.replace(']', ',')
                newcourt = backcourt.replace('(', ',')
                oldcourt = newcourt.replace(')', ',')

                sosplit = (oldcourt.split(','))
                #print(sosplit[:-4])
                casename = (''.join(sosplit[:-4]))

                casesplit = casename.split('v')
                try:
                    #print(casesplit)
                    vslist.append(casesplit)
            #dicthis = dict({'party1' : (casesplit[0]), 'party2' : casesplit[1]})
                except 'IndexError':
                    pass

                #dicthis = dict({'party1' : (casesplit[0]), 'party2' : casesplit[1]})



        #print(sosplit[-2:-1])
                #casedate =  (''.join(sosplit[-2:-1]))


                #bstxt = bs4.BeautifulSoup(reqsearch.text)

                #sometxt = (bstxt.find_all('li', {'class' : 'multi'}))

                #print(sometxt)



                #for somet in sometxt:
                #    print(somet.text)


            return '''
                    {}
                      '''.format(vslist)

        return '''
                <!DOCTYPE html>
            <html>
            <head>
              <title>Search legal materials</title>
              <script src="https://unpkg.com/vue"></script>
              <script src="node_modules/vue/vue.min.js"></script>
              <link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap/dist/css/bootstrap.min.css"/>
              <link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css"/>
              <meta name="viewport" content="width=device-width, initial-scale=1">
              </head>
              <body>
                <img src="static/header.jpg"><br>
                <h1>Search Recent legal materials API</h1><br>
                <p>Example: au, nsw, NSWSC</p><br>
                <p>This returns party1 and party2 in recent cases.</p>
                <form method="POST">
                  <fieldset>
                    <legend>Search legal materials:</legend>
                      countrycode: <input type="text" name="countrycode"><br>
                      statecode : <input type="text" name="statecode"><br>
                      courtcode : <input type="text" name="courtcode"><br>
                      <input type="submit" value="Submit"><br>
                      </fieldset>
                  </form></body>'''
In [ ]:
memename = request.json.get('memename')

    toptext = request.json.get('toptext')
    toptext = toptext.upper()

    bottomtext = request.json.get('bottomtext')
    bottomtext = bottomtext.upper()
    user= request.json.get('user')

    timnow = arrow.now()
    timstr = timnow.timestamp

    galdirdir = '/home/{}/artctrl/meme/galleries/{}/'.format(myusr, user)



    #with open('/home/{}/rbnz-tech-backup/artctrl/meme/galleries/default')

    img = Image.open('/home/{}/artctrl/meme/galleries/default/{}.jpg'.format(myusr, memename))

    imageSize = img.size

    # find biggest font size th90t works
    fontSize = int(imageSize[1]/5)
    font = ImageFont.truetype("/home/{}/Downloads/impact.ttf".format(myusr), fontSize)
    topTextSize = font.getsize(toptext)
    bottomTextSize = font.getsize(bottomtext)

    while topTextSize[0] > imageSize[0]-20 or bottomTextSize[0] > imageSize[0]-20:
        fontSize = fontSize - 1
        font = ImageFont.truetype("/home/{}/Downloads/impact.ttf".format(myusr), fontSize)
        topTextSize = font.getsize(toptext)
        bottomTextSize = font.getsize(bottomtext)

    # find top centered position for top text
    topTextPositionX = (imageSize[0]/2) - (topTextSize[0]/2)
    topTextPositionY = 0
    topTextPosition = (topTextPositionX, topTextPositionY)

    # find bottom centered position for bottom text
    bottomTextPositionX = (imageSize[0]/2) - (bottomTextSize[0]/2)
    bottomTextPositionY = imageSize[1] - bottomTextSize[1] -10
    bottomTextPosition = (bottomTextPositionX, bottomTextPositionY)

    draw = ImageDraw.Draw(img)

    outlineRange = int(fontSize/15)
    for x in range(-outlineRange, outlineRange+1):
        for y in range(-outlineRange, outlineRange+1):
                draw.text((topTextPosition[0]+x, topTextPosition[1]+y), toptext, (0,0,0), font=font)
                draw.text((bottomTextPosition[0]+x, bottomTextPosition[1]+y), bottomtext, (0,0,0), font=font)

        draw.text(topTextPosition, toptext, (255,255,255), font=font)
        draw.text(bottomTextPosition, bottomtext, (255,255,255), font=font)
        img.save('/home/{}/artctrl/meme/galleries/{}/{}-{}.jpg'.format(myusr, user, memename, timstr))

        #img.save("/home/{}/memetest/galleries/{}/{}.jpg".format(myusr, usrfolz, gtm['id']))


    memedict = dict({'meme' : memename, 'toptext' : toptext.upper(), 'bottomtext' : bottomtext.upper(), 'imagepath' : '/home/{}/rbnz-tech-backup/artctrl/meme/galleries/{}/{}-{}.jpg'.format(myusr, user, memename, timstr)})
    return(jsonify(memedict))
In [113]:
app = Flask(__name__)
api = Api(app)

#CCBY CCBYNCSA CCBYSA CCBYND CCBYNCND CCBYND CCZERO CCPUBDOMAIN

class ccby(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/license/standard/get?commercial=y&derivatives=y')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['html']['a'][1]['#text']
        ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by.svg'})})}) 
        return licdic
    
class ccbync(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/license/standard/get?commercial=n&derivatives=y')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['html']['a'][1]['#text']
        ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by-nc.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc.svg'})})}) 
        return licdic
    
class ccbyncsa(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/details?license-uri=http://creativecommons.org/licenses/by-nc-sa/4.0/')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['html']['a'][1]['#text']
        ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-sa.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by-nc-sa.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-sa.svg'})})}) 
        return licdic

class ccbysa(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/details?license-uri=http://creativecommons.org/licenses/by-sa/4.0/')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['html']['a'][1]['#text']
        ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-sa.svg'})})
        return licdic
        
class ccbync(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/license/standard/get?commercial=n&derivatives=y')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['html']['a'][1]['#text']
        ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by-nc.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc.svg'})})}) 
        return(licdic)

    
class ccbyncnd(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/license/standard/get?commercial=n&derivatives=n')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['html']['a'][1]['#text']
        ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by-nc-nd.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by-nc-nd.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nc-nd.svg'})})}) 
        return licdic
    
class ccbynd(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/license/standard/get?commercial=y&derivatives=n')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['html']['a'][1]['#text']
        ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/nd.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/by-nd.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/by-nd.svg'})})}) 
        return licdic
    
class cczero(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/details?license-uri=http://creativecommons.org/publicdomain/zero/1.0/')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['license-name']
        ccimglic = xmpar['result']['html']['p']['a']['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-zero.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/cc-zero.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/cc-zero.svg'})})}) 
        return licdic

class ccpubdom(Resource):
    def get(self):
        ccdev = requests.get('http://api.creativecommons.org/rest/dev/details?license-uri=http://creativecommons.org/publicdomain/mark/1.0/')
        xmpar = xmltodict.parse(ccdev.text)
        ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
        cchtmtxt = xmpar['result']['license-name']
        ccimglic = xmpar['result']['html']['p']['a']['img']['@src']
        licdic = dict({'url' : ccabtlic, 'text' : cchtmtxt, 'img' :
        dict({'fullbutton' : dict({'png' : ccimglic, 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/cc-publicdomain.svg'}),
             'halfbutton' : dict({'png' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/png/cc-publicdomain.png',
                                 'svg' : 'http://mirrors.creativecommons.org/presskit/buttons/80x15/svg/cc-publicdomain.svg'})})}) 
        
        return licdic
    
api.add_resource(ccby, '/by')

api.add_resource(ccbync, '/bync')

api.add_resource(ccbynd, '/bynd')

api.add_resource(ccbyncnd, '/byncnd')

api.add_resource(ccbysa, '/bysa')
                 
api.add_resource(ccbyncsa, '/byncsa')

api.add_resource(cczero, '/zero')

api.add_resource(ccpubdom, '/publicdomain')

if __name__ == '__main__':
    app.run(host = '0.0.0.0')
---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-113-222dde2a7eb2> in <module>()
     12 
     13 if __name__ == '__main__':
---> 14     app.run(host = '0.0.0.0')

/usr/local/lib/python3.4/dist-packages/flask/app.py in run(self, host, port, debug, **options)
    841         options.setdefault('passthrough_errors', True)
    842         try:
--> 843             run_simple(host, port, self, **options)
    844         finally:
    845             # reset the first request information if the development server

/usr/local/lib/python3.4/dist-packages/werkzeug/serving.py in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context)
    692                           reloader_type)
    693     else:
--> 694         inner()
    695 
    696 

/usr/local/lib/python3.4/dist-packages/werkzeug/serving.py in inner()
    654                           processes, request_handler,
    655                           passthrough_errors, ssl_context,
--> 656                           fd=fd)
    657         if fd is None:
    658             log_startup(srv.socket)

/usr/local/lib/python3.4/dist-packages/werkzeug/serving.py in make_server(host, port, app, threaded, processes, request_handler, passthrough_errors, ssl_context, fd)
    548     else:
    549         return BaseWSGIServer(host, port, app, request_handler,
--> 550                               passthrough_errors, ssl_context, fd=fd)
    551 
    552 

/usr/local/lib/python3.4/dist-packages/werkzeug/serving.py in __init__(self, host, port, app, handler, passthrough_errors, ssl_context, fd)
    462                                       socket.SOCK_STREAM)
    463             port = 0
--> 464         HTTPServer.__init__(self, (host, int(port)), handler)
    465         self.app = app
    466         self.passthrough_errors = passthrough_errors

/usr/lib/python3.4/socketserver.py in __init__(self, server_address, RequestHandlerClass, bind_and_activate)
    427                                     self.socket_type)
    428         if bind_and_activate:
--> 429             self.server_bind()
    430             self.server_activate()
    431 

/usr/lib/python3.4/http/server.py in server_bind(self)
    131     def server_bind(self):
    132         """Override server_bind to store the server name."""
--> 133         socketserver.TCPServer.server_bind(self)
    134         host, port = self.socket.getsockname()[:2]
    135         self.server_name = socket.getfqdn(host)

/usr/lib/python3.4/socketserver.py in server_bind(self)
    438         if self.allow_reuse_address:
    439             self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
--> 440         self.socket.bind(self.server_address)
    441         self.server_address = self.socket.getsockname()
    442 

OSError: [Errno 98] Address already in use
In [3]:
#licstand = requests.get('http://api.creativecommons.org/rest/1.5/license/standard')
In [7]:
#dictlic = xmltodict.parse(licstand.text)
In [21]:
#lenfield = len(dictlic['licenseclass']['field'])
In [36]:
#for lenf in range(0, lenfield):
#    print(dictlic['licenseclass']['field'][lenf]['label'])
    
    #print(dictlic['licenseclass']['field'][lenf]['@id'])
    
    #print(dictlic['licenseclass']['field'][lenf])
    
    #print(dictlic['licenseclass']['field'][lenf]['description'])
OrderedDict([('@xml:lang', 'en'), ('#text', 'Allow commercial uses of your work?')])
OrderedDict([('@xml:lang', 'en'), ('#text', 'Allow modifications of your work?')])
OrderedDict([('@xml:lang', 'en'), ('#text', 'Jurisdiction of your license')])
In [ ]:
#ShareAlike
In [134]:
#ccdev = requests.get('http://api.creativecommons.org/rest/dev/license/standard/get?commercial=n&derivatives=y')
In [135]:
#xmpar = xmltodict.parse(ccdev.text)
In [136]:
#xmpar['result']['rdf']['rdf:RDF']
Out[136]:
OrderedDict([('@xmlns', 'http://creativecommons.org/ns#'),
             ('@xmlns:rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
             ('Work',
              OrderedDict([('@xmlns:dc', 'http://purl.org/dc/elements/1.1/'),
                           ('@rdf:about', ''),
                           ('license',
                            OrderedDict([('@rdf:resource',
                                          'http://creativecommons.org/licenses/by-nc/4.0/')]))])),
             ('License',
              OrderedDict([('@rdf:about',
                            'http://creativecommons.org/licenses/by-nc/4.0/'),
                           ('permits',
                            [OrderedDict([('@rdf:resource',
                                           'http://creativecommons.org/ns#DerivativeWorks')]),
                             OrderedDict([('@rdf:resource',
                                           'http://creativecommons.org/ns#Distribution')]),
                             OrderedDict([('@rdf:resource',
                                           'http://creativecommons.org/ns#Reproduction')])]),
                           ('requires',
                            [OrderedDict([('@rdf:resource',
                                           'http://creativecommons.org/ns#Attribution')]),
                             OrderedDict([('@rdf:resource',
                                           'http://creativecommons.org/ns#Notice')])])]))])
In [128]:
#xmpar['result']['rdf']['rdf:RDF']['@xmlns']
Out[128]:
'http://creativecommons.org/ns#'
In [129]:
#xmpar['result']['rdf']['rdf:RDF']['Work']
Out[129]:
OrderedDict([('@xmlns:dc', 'http://purl.org/dc/elements/1.1/'),
             ('@rdf:about', ''),
             ('license',
              OrderedDict([('@rdf:resource',
                            'http://creativecommons.org/licenses/by/4.0/')]))])
In [130]:
#xmpar['result']['rdf']['rdf:RDF']['License']
Out[130]:
OrderedDict([('@rdf:about', 'http://creativecommons.org/licenses/by/4.0/'),
             ('permits',
              [OrderedDict([('@rdf:resource',
                             'http://creativecommons.org/ns#DerivativeWorks')]),
               OrderedDict([('@rdf:resource',
                             'http://creativecommons.org/ns#Distribution')]),
               OrderedDict([('@rdf:resource',
                             'http://creativecommons.org/ns#Reproduction')])]),
             ('requires',
              [OrderedDict([('@rdf:resource',
                             'http://creativecommons.org/ns#Attribution')]),
               OrderedDict([('@rdf:resource',
                             'http://creativecommons.org/ns#Notice')])])])
In [120]:
#ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
In [121]:
#ccabtlic
Out[121]:
'http://creativecommons.org/licenses/by/4.0/'
In [92]:
#for perm in xmpar['result']['rdf']['rdf:RDF']['License']['permits']:
#    print(perm['@rdf:resource'])
http://creativecommons.org/ns#DerivativeWorks
http://creativecommons.org/ns#Distribution
http://creativecommons.org/ns#Reproduction
In [93]:
#xmpar['result']['html']['#text']
Out[93]:
'This work is licensed under a .'
In [107]:
#cchtmtxt = xmpar['result']['html']['a'][1]['#text']
In [108]:
#ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
In [109]:
#http://mirrors.creativecommons.org/presskit/buttons/88x31/svg/by.svg
In [111]:
#licdic = dict({'licurl' : ccabtlic, 'lictext' : cchtmtxt, 'ccimg' : ccimglic})
In [112]:
#licdic
Out[112]:
{'ccimg': 'http://i.creativecommons.org/l/by/4.0/88x31.png',
 'lictext': 'Creative Commons Attribution 4.0 International License',
 'licurl': 'http://creativecommons.org/licenses/by/4.0/'}
In [138]:
#ccdev = requests.get('http://api.creativecommons.org/rest/dev/details?license-uri=http://creativecommons.org/licenses/by-nc-sa/4.0/')
In [141]:
#reqccsa.text

#xmpar = xmltodict.parse(reqccsa.text)
#ccabtlic = xmpar['result']['rdf']['rdf:RDF']['License']['@rdf:about']
#cchtmtxt = xmpar['result']['html']['a'][1]['#text']
#ccimglic = xmpar['result']['html']['a'][0]['img']['@src']
#licdic = dict({'licurl' : ccabtlic, 'lictext' : cchtmtxt, 'ccimg' : ccimglic})
In [142]:
#licdic
Out[142]:
{'ccimg': 'http://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png',
 'lictext': 'Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License',
 'licurl': 'http://creativecommons.org/licenses/by-nc-sa/4.0/'}
In [ ]:
#http://api.creativecommons.org/rest/dev/simple/chooser
In [ ]:
#http://api.creativecommons.org/rest/dev/details?license-uri=creativecommons.org
    
#http://api.creativecommons.org/rest/dev/details?license-uri=http://creativecommons.org/licenses/by-nc-sa/4.0/

Comments

Comments powered by Disqus