BuildingRESTfulPythonWebServices
packtpub出版,用实例分别介绍了使用python中的django,flask,tornado 三种web框架如何编写restful API服务。主要软件版本为python 3.5+,django 1.10,django-rest-framework 3.3.3,flask 0.11,flask-restful 0.3.5,tornado 4.4.1 。书的代码在https://github.com/PacktPublishing/Building-RESTful-Python-Web-ServicesBuilding RESTful Python Web ServicesCopyright o 2016 Packt PublishingAll rights reserved no part of this book may be reproduced stored in a retrieval system, ortransmitted in any form or by any means, without the prior written permission of thepublisher, except in the case of brief quotations embedded in critical articles or reviewsEvery effort has been made in the preparation of this book to ensure the accuracy of theinformation presented However, the information contained in this book is sold withoutwarranty, either express or implied. Neither the author nor Packt Publishing, and itsdealers and distributors will be held liable for any damages caused or alleged to be causeddirectly or indirectly by this bookPackt Publishing has endeavored to provide trademark information about all of thecompanies and products mentioned in this book by the appropriate use of capitalsHowever, Packt Publishing cannot guarantee the accuracy of this informationFirst published: October 2016Production reference: 1201016Published by packt Publishing ltdry place35 Livery StreetBibirminghamB3 2PB. UKISBN978-1-78646-225-1www.pAcktpub.comCreditsAuthorCopy EditorGaston c. hillarSneha singhReviewerProject CoordinatorElmer thomasSheejal shahCommissioning editorPproofreaderAaron lazarSafis editingAcquisition editorindexerReshma ramanRekha nairContent Development Editor GraphicsDivij KotianJason monteiroTechnical editorProduction coordinatorGebin georgeMelwyn dsaAbout the authorGaston C. hillar is italian and has been working with computers since he was eight. Hebegan programming with the legendary Texas TI-99/4A and Commodore 64 homecomputers in the early 80s he has a bachelor s degree in Computer science from which hegraduated with honors, and an MBa from which he graduated with an outstanding thesisAt present, gaston is an independent it consultant and freelance author who is alwayslooking for new adventures around the worldHe has been a senior contributing editor at Dr. Dobb's and has written more than a hundredarticles on software development topics gaston was also a former microsoft mvp intechnical computing. He has received the prestigious Intel Black Belt Software Developeraward eight timesHeisaguestbloggeratIntelSoftwareNetwork(http://software.intel.com).youcanreachhimatgastonhillar@hotmail.comandfollowhimontwitterathttp://twitter.com/gastonhillar.Gaston'sblogishttp://csharpmulticore.blogspot.comHe lives with his wife, vanesa, and his two sons Kevin and brandonAcknowledgmentsAt the time of writing this book, I was fortunate to work with an excellent team at PacktRaman and Aaron Lazar allowed me to provide them ideas to develop this book and/Publishing, whose contributions vastly improved the presentation of this book. reshmumped into the exciting project of teaching how to use many popular web frameworks todevelop restful Web services with Python 3.5. Divij Kotian helped me realize my visionfor this book and provided many sensible suggestions regarding the text, the format and theflow. The reader will notice his great work. It was great working with Divij in another bookIn fact, it is the third book in which i was able to work with reshma and Divij It's beengreat working with them in another project and I cant wait to work with them again. Iwould like to thank my technical reviewers and proofreaders, for their thorough reviewsand insightful comments. i was able to incorporate some of the knowledge and wisdomthey have gained in their many years in the software development industry. This book waspossible because they gave valuable feedbackGebin george did a wonderful job when the book moved into the production stage. He hasmade all the necessary adjustments to generate the final version of the book with anoutstanding layout gebin made the book easy to read in its different versions and madesure I was happy with the results. a book like this one with so many tables, figures, piecesof code, commands and sample outputs requires skilled people with eye for detail duringall the stages. I was fortunate to have Gebin onboard. I would like to thank my technicalreviewers and proofreaders, for their thorough reviews and insightful comments. I was ableto incorporate some of the knowledge and wisdom they have gained in their many years inthe software development industry. This book was possible because they gave valuableedpackI usually start writing notes about ideas for a book when I spend time at softwaredevelopment conferences and events. I wrote the initial idea for this book in San franciscoCalifornia, at Intel Developer Forum 2015. One year later, at Intel Developer Forum 2016, Ihad the chance to discuss with many software engineers the book I was finishing andincorporate their suggestions in the final draftsThe entire process of writing a book requires a huge amount of lonely hours. i wouldnt beable to write an entire book without dedicating some time to play soccer against my sonsKevin and Brandon, and my nephew, Nicolas. Of course, I never won a match. However, Idid score a few goalsabout the reviewerElmer Thomas completed a B.S. in Computer Engineering and a M.S. in ElectricalEngineering at the University of California, Riverside. His focus was on Control Systems,specifically GPS navigation systems, spending several years serving as a research assistant,building software and hardware for self driving cars at u c. riverside and berkeleresulting in 2 co-publications: Aided Integer Ambiguity resolution Algorithm and Data Fusion viaKalman Filter: GPS INS During the final years of his Masters program, he added a fewmentors, partners and some business skills through the Tuck Executive Program atDartmouth to his repertoire and co-founded several companies with varying degrees ofachieving over 50 awards from local and state government for service in the community ilesuccess over the next 7 years. During this time he helped hundreds of business profit whileWhile building businesses, Elmer served on various boards to help foster growth in localbusiness communities in Riverside and Orange County, including the riverside TechnologyCEO Forum, the TechBiz Connection, OCTANe and TriTech. Next, he began serving atSend Grid, an email aPI and Service Company, as one of the first 5 employees in a now 300+employee company on the verge of going public. Service began as the web developmentmanager and then he moved into a product development role while helping build out aquality assurance program. After spending 2 years traveling to over 50 events, speaking,teaching and mentoring as a Developer Evangelist within the Send Grid marketingdepartment, elmer then served as the hacker in residence on the community team atSend grid. In that role he mentored over 50 startups, many belonging to accelerators such asTechstars and 500 Startups, and hundreds of developers through live consulting anddevelopment of productivity content and softwareHe currently serves as the Developer Experience Engineer at SendGrid, leading, developingand managing Send Grid's open source community, which includes over 24 active projectsacross 7 programming languages. These open source projects process hundreds of millionsof emails per day for our customers. He also serves as Vice President of the Council for theAdvancement of Black Engineers, drawing from experience as chapter president of theNational Society of black Engineers while a student at U C Riverside, supporting ourmission to increase the number of culturally responsible black engineers with phds post-doctoral training and professional engineering registrationsAs member of the board of directors for Operation Code, he helps equip military veteransand their families with programming knowledge through mentorship to help veteranscreate new career paths in software development. Through his volunteer work with theGirls Scouts of San Gorgonio Council, Elmer focuses on helping bring STEm experiences togirls, specifically within the age groups between 9 and 14 years old, including his own 11year old daughter who is now a girl Scout cadette To help serve his local community he isa member of the board of directors of his local hoa. he is considered a social mediainfluencer, driving 100s of millions of visits to various web pages. he is known asThinking Serious on various social networksElmer's passions include family time with his wife, and 2 daughters, reading writingwatching videos, especially in virtual reality, developing software and creating in generalespecially in the area of personal development and productivity through quantificationtechniques i would like to thank my wife linda and daughter audrey for their patienceand quiet time for me to complete this reviewMoredetailcanbefoundathisblogThinkingserious.comwww.paCktpub.comForsupportfilesanddownloadsrelatedtoyourbookpleasevisitwww.packtpub.ComDid you know that packt offers e book versions of every book published, with pdf andepubfilesavailableyoUcanupgradetotheebookversionatwww.packtpub.comandasaprint book customer, you are entitled to a discount on the ebook copy. Get in touch with usat service@packtpub com for more detailsAtwww.packtpub.comyoucanalsoreadacollectionoffreetechnicalarticlessignupforarange of free newsletters and receive exclusive discounts and offers on Packt books andeBooKsMapthttps://www.packtpub.com/maptGet the most in-demand software skills with Mapt. Mapt gives you full access to all Packtbooks and video courses, as well as industry-leading tools to help you plan your personaldevelopment and advance your careerWhy subscribe?Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browserTable of contentsPrefaceChapter 1: Developing RESTful APIs with DjangoDesigning a RESTful API to interact with a simple sQLite database8Understanding the tasks performed by each Http method9Working with lightweight virtual environmentsSetting up the virtual environment with Django REST framework16Creating the modelsManaging serialization and deserializationWriting apl views30Making Http requests to the Apl36Workingwithcommand-linetools-curlandhttpie36Working with GUI tools- Postman and others47Test your knowledge55Summary56Chapter 2: Working with Class-Based views and Hyperlinked APls inDjango57Using model serializers to eliminate duplicate code58Working with wrappers to write API views59Using the default parsing and rendering options and move beyondJSON62Browsing the APl69Designing a resTful API to interact with a complex PostgreSQLdatabaseUnderstanding the tasks performed by each Http method75Declaring relationships with the models78Managing serialization and deserialization with relationships andhyperlinks88Creating class-based views and using generic classes94Taking advantage of generic class based views95Working with endpoints for the APl97Creating and retrieving related resources102Test your knowledge110Summary112
下载地址
用户评论