Çöó½ºÅ© - ¸ù¼º

MongoDB / MongoEngine ¿ë Flask RESTful API ÇÁ·¹ÀÓ ¿öÅ©
Áö±Ý ´Ù¿î·Îµå

Çöó½ºÅ© - ¸ù¼º ¼øÀ§ ¹× ¿ä¾à

±¤°í

  • Rating:
  • ƯÇã:
  • BSD License
  • °¡°Ý:
  • FREE
  • °Ô½ÃÀÚ À̸§:
  • Anthony Nemitz
  • °Ô½ÃÀÚ À¥»çÀÌÆ®:
  • http://github.com/elasticsales/

Çöó½ºÅ© - ¸ù¼º ű×


Çöó½ºÅ© - ¸ù¼º ¼³¸í

Flask-Mongorest´Â MongoDB / mongoengineÀ»À§ÇÑ RESTFOT API ÇÁ·¹ÀÓ ¿öÅ©ÀÔ´Ï´Ù. FLASKFROM FLASK.EXT.EXT.EXT.MONGOSTFROM FLASK.EXT.MONGOREST.EXTMONTESTFROM FLASK.ext.mongorest.ext.ext.mongorest.ext .ext.Ext.ext.mongorest import ¸Þ¼Òµå App = flask (__ name __) app.config.update (mongodb_port = 'mongodb_port ='mongost_example_app ') db = mongoengine (mongodb_b_port ='mongodb_host = 'mongodb_port ='mongodb_host = 'localhost' ¾Û) API = mongorest (¾Û) Ŭ·¡½º »ç¿ëÀÚ (db.document) : email = db.emailfield (unique = true, required = true) Ŭ·¡½º ÄÁÅÙÃ÷ (db.embeddeddocument) : text = db.stringfield () Ŭ·¡½º contentResource (ÀÚ¿ø) : document = contentClass post (db.document) : title = db.stringfield (max_length = 120, Çʼö = true) ÀÛ¼ºÀÚ = db.referencefield (»ç¿ëÀÚ) content = db.embeddeddocumentfield (ÄÁÅÙÃ÷) Ŭ·¡½º postResource (ÀÚ¿ø) : document = post { 'content': contentResource,} filters = { 'title': , 'author_id': ,} rename_fields = { "Author ':'author_id ',} @ api.register (name ='posts ', url ='/ posts / ' ) Ŭ·¡½º PostView (resourceview) : resource = postResource ¸Þ¼Òµå = ÀÌ ¾ÛÀ» »ç¿ëÇÏ¸é ´ÙÀ½ curl ¸í·ÉÀ» »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. post : curl -h "content- À¯Çü : ÀÀ¿ë ÇÁ·Î±×·¥ / json "-x post -d \ '{"title ":"first post! ","author_id_from_a_previous_api_call ","content ": {"text ":"ÀÌ°ÍÀº ¿ì¸®ÀÇ Å×½ºÆ® °Ô½Ã¹° ÄÜÅÙÃ÷ "} } 'http://0.0.0:5000/posts/ { "ID": "1", "title": "first post!", "author_id_id": "author_id_from_a_previous_api_call", "content": { "text": "ÀÌ°ÍÀº ¿ì¸®ÀÇ Å×½ºÆ® °Ô½Ã¹° ÄÜÅÙÃ÷ÀÔ´Ï´Ù"}} °Ô½Ã¹°À» ¾òÀ¸½Ê½Ã¿À : curl http://0.0.0.0:5000/posts/1// { ""ID ":"1 ","title ":"first post! ","author_id ":"author_id_from_a_previous_api_call ","content ": {"text ":"ÀÌ°ÍÀº Å×½ºÆ® °Ô½Ã¹° ÄÜÅÙÃ÷ÀÔ´Ï´Ù. "}} Á¦¸ñÀ¸·Î ¸ðµç °Ô½Ã¹°À̳ª ÇÊÅ͸¦ ³ª¿­ÇÕ´Ï´Ù. curl http://0.0.0.0:5000/posts/ ¶Ç´Â curl http : //0.0.0.0 : 5000 / °Ô½Ã¹° /? title__startswith = Àü³ª¹« ST POST { "µ¥ÀÌÅÍ": . Len (±ÇÇÑ ºÎ¿© ) == 2 ¹× ±ÇÇÑ ºÎ¿© .lower () == '±âº»': Try : Authorization_parts = base64.b64decode (±ÇÇÑ ºÎ¿© ). ÆÄƼ¼Ç ( ':') key = smart_unicode (Authorization_Parts ) API_KEY = apikey.objects.get (key__exact = Å°) api_key.user : login_user (api_key.user) setAttr (current_user, 'api_key', api_key) (typeError, unicodeDeCodeError, apikey.doesnotexist)À» Á¦¿ÜÇÏ°í true¸¦ µ¹·ÁÁÝ´Ï´Ù. Æнº ¸®ÅÏ falseclass baseresourceview (resourceview ) : Authentication_Methods = TEST SUITETHIS ÆÐÅ°Áö¸¦ ½ÇÇàÇÏ´Â °ÍÀº ÀÚµ¿ Å×½ºÆ®¸¦ À§ÇØ NOSETEST¸¦ »ç¿ëÇÕ´Ï´Ù. Å×½ºÆ®¸¦ ½ÇÇàÇÏ·Á¸é Python Setup.py NoSetests¸¦ ½ÇÇàÇϽʽÿÀ. ¼³Á¤À̳ª ´Ù¸¥ Áغñ°¡ ÇÊ¿äÇÏÁö ¾Ê½À´Ï´Ù .ContributingPull ¿äûÀº Å©°Ô °¨»çÇÕ´Ï´Ù! Á¦Ç°ÀÇ È¨ÆäÀÌÁö


Çöó½ºÅ© - ¸ù¼º °ü·Ã ¼ÒÇÁÆ®¿þ¾î

SendTx.

¸í·É ÁÙ¿¡¼­ Bitcoin ³×Æ®¿öÅ©·Î Á÷·ÄÈ­ µÈ Bitcoin Æ®·£Àè¼Ç º¸³»±â ...

105

´Ù¿î·Îµå