6
최근 appengine 응용 프로그램에서 작업했습니다. 나는 애플 리케이션에 요청에 포함 된 json 데이터를 구문 분석하고 싶습니다. 어떻게 이것을 달성하기 위해 requesthandler 클래스의 request 객체를 사용합니까?응용 프로그램에서 json 형식의 요청을 구문 분석
import cgi
import webapp2
import datamethods
from google.appengine.ext.webapp.util import run_wsgi_app
class adduser(webapp2.RequestHandler):
def get(self):
# Get the phone number from json data in request.
userphone = self.request.get("phone")
# Get the name from json data in request.
name = self.request.get("name")
app = webapp2.WSGIApplication([
('/adduser', adduser),
('/sign', updatestatus),
('/login',login)
], debug=True)
def main():
run_wsgi_app(app)
if __name__ == "__main__":
main()
brilliant..thanks .... 은 내가 붙박이 JSON 라이브러리과 같이 사용 :
및 그 – koladotnet당신이 정말로 여전히 간단한 JSON을해야합니까 ... 그것을 해결 왜 그냥 아들? –
Python SDK 버전 1.9.55부터. ujson을 사용할 수 있습니다. UltraJSON은 순수 C로 작성된 초고속 JSON 인코더 및 디코더입니다. – voscausa