»Ë»Ñ Æ÷·³
°³¹ßÀÚÆ÷·³ ÀÔ´Ï´Ù.
  • ºÏ¸¶Å© ¾ÆÀÌÄÜ

simple json api ¿øÇÏ´Â °ª 2°³´Â ¾î¶»°Ô °Ë»öÇÒ ¼ö ÀÖÀ»±î¿ä2

def api(request):
    q = request.GET['q']
    words = wordnet.synsets(q)  
    king =[]
  
    for synset in words:
        king.append({"lemma_names" : synset.lemma_names})
        king.append({"lexname" : synset.lexname})
        king.append({"definition" : synset.definition})
        king.append({"examples" : synset.examples})
              
    return HttpResponse(simplejson.dumps(king), mimetype='application/json')            
  

À̺κÐÀÌ Ã³¸®ÇÏ´Â ºÎºÐÀ̱¸¿ä

urlpatterns = patterns('',
        url(r'^api/search/$', 'shop.main.api')
)

À̺κÐÀÌ urlsºÎºÐÀÔ´Ï´Ù

ÇöÀç  ...api/search/?q=apple   ·Î ÇßÀ»°æ¿ì

apple¿¡ °üÇÑ Á¤º¸´Â ºê¶ó¿ìÀú»ó¿¡¼­ º¼ ¼ö Àִµ¥¿ä,

¸¸¾à 2°³ÀÇ ´Ü¾î¸¦ °Ë»öÇؼ­ º¸°í ½ÍÀ¸¸é

¾î¶»°Ô ÇØ¾ß Çϳª¿ä..

±¸±Û¸µÀ» ÇÏ°íÀִµ¥,

¿øÇÏ´Â ±ÛÀÌ ¾ø¾î¼­¿ä ..

Çѹø¿¡ µÎ°³ÀÇ °ªÀ» ÀÐ°í ½ÍÀºµ¥,

api/search/?q=apple?q=cute

ÀÌ·¸°Ô ´Ü¼øÈ÷ »ý°¢Çß¾ú´Âµ¥ »ý°¢ ó·³Àº ¾ÈµÇÁö¿ä,,,¤¾¤¾¤¾;

0
ÃßõÇϱ⠴ٸ¥ÀÇ°ß 0
|
°øÀ¯¹öÆ°

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 ¸´Æ®¸Ó½º

´Ù¸¥ÀÇ°ß 0 Ãßõ 0 °íµµ¸®Àλý
  • ¾Ë¸² ¿å¼³, »óó ÁÙ ¼ö ÀÖ´Â ¾ÇÇÃÀº »ï°¡ÁÖ¼¼¿ä.
©¹æ »çÁø  
¡â ÀÌÀü±Û¡ä ´ÙÀ½±Û ¸ñ·Ïº¸±â