A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python...
Transcript of A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python...
![Page 1: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/1.jpg)
A Python a web service
A Python a web service@vtemian
![Page 2: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/2.jpg)
A Python a web service
Let’s imaginea perfect world...
![Page 3: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/3.jpg)
A Python a web service
WEB APPLICATION
![Page 4: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/4.jpg)
A Python a web serviceWEB APPLICATION
Tools & Utilities
![Page 5: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/5.jpg)
A Python a web serviceWEB APPLICATION
Tools & Utilities Web Process
![Page 6: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/6.jpg)
A Python a web service
Tools & Utilities Web Process Worker Process
WEB APPLICATION
![Page 7: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/7.jpg)
A Python a web service
Tools & Utilities
management tools
supporting services
Web Process Worker Process
WEB APPLICATION
![Page 8: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/8.jpg)
A Python a web service
Tools & Utilities
management tools
supporting services
Web Process
user interface
api service
data persistence
auth
crud admin
Worker Process
WEB APPLICATION
![Page 9: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/9.jpg)
A Python a web service
Tools & Utilities
management tools
supporting services
Web Process
user interface
api service
data persistence
auth
crud admin
Worker Process
deferred tasks
scheduled tasks
WEB APPLICATION
![Page 10: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/10.jpg)
A Python a web service
Tools & Utilities
management tools
supporting services
Web Process
user interface
api service
data persistence
auth
crud admin
Worker Process
deferred tasks
scheduled tasks
WEB APPLICATION
![Page 11: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/11.jpg)
A Python a web service
Tools & Utilities
management tools
supporting services
Web Process
user interface
api service
data persistence
auth
crud admin
Worker Process
deferred tasks
scheduled tasks
WEB APPLICATION
![Page 12: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/12.jpg)
A Python a web service
Tools & Utilities
management tools
supporting services
Web Process
user interface
api service
data persistence
auth
crud admin
Worker Process
deferred tasks
scheduled tasks
WEB APPLICATION
![Page 13: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/13.jpg)
A Python a web service
Tools & Utilities
management tools
supporting services
Web Process
user interface
api service
data persistence
auth
crud admin
Worker Process
deferred tasks
scheduled tasks
WEB APPLICATION
![Page 14: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/14.jpg)
A Python a web service
Single codebase areEVIL!
![Page 15: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/15.jpg)
A Python a web serviceWEB APPLICATION
Tools & Utilities
management tools
supporting services
Web Process
user interface
api service
data persistence
auth
crud admin
Worker Process
deferred tasks
scheduled tasksTOTAL MESS
![Page 16: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/16.jpg)
A Python a web service
Decouple!
![Page 17: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/17.jpg)
A Python a web service
Developers
API service
Data persistence
Frontend
End Users
![Page 18: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/18.jpg)
A Python a web service
Developers End Users Internal
API service API service API service
Data persistence
![Page 19: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/19.jpg)
A Python a web service
Good API
![Page 20: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/20.jpg)
A Python a web service
Good API
![Page 21: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/21.jpg)
A Python a web service
Good APIIntuitive
similar things should be similar, ugly things should look ugly
Documented
Opinionated
![Page 22: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/22.jpg)
A Python a web service
Featurespagination
propper HTTPresponse handling throttling
permissions serializationauthentification
posting of data with validation
![Page 23: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/23.jpg)
A Python a web service
Django
regex routing system
![Page 24: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/24.jpg)
A Python a web service
Django
regex routing system built-in orm
![Page 25: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/25.jpg)
A Python a web service
users = Users.objects.filter(last_login__lt=timestamp)
Django
![Page 26: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/26.jpg)
A Python a web service
regex routing system
authmigrations
management tools makes decision for you
templating system
built-in orm crud admin
testing tools
Django
![Page 27: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/27.jpg)
A Python a web service NOBODY CARES
![Page 28: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/28.jpg)
A Python a web service
Developers End Users Internal
API service API service API service
Data persistence
Django
![Page 29: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/29.jpg)
A Python a web service
regex routing system
makes decision for you
templating system
testing tools
Django
![Page 30: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/30.jpg)
A Python a web service
![Page 31: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/31.jpg)
A Python a web service
Django REST Framework
![Page 32: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/32.jpg)
A Python a web service
Just install it, write 20 lines of code> CRUD API
![Page 33: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/33.jpg)
A Python a web service
API Console
![Page 34: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/34.jpg)
A Python a web service
Great community
![Page 35: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/35.jpg)
A Python a web service
Easy to document your API
![Page 36: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/36.jpg)
A Python a web service
Integration test usingAPIRequestFactory
![Page 37: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/37.jpg)
A Python a web service
OAuth 1 & 2 out of the box
![Page 38: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/38.jpg)
A Python a web service
Serialization
![Page 39: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/39.jpg)
A Python a web service
Django paginatoror PaginationSerializer
![Page 40: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/40.jpg)
A Python a web service
Object or field level validation
![Page 41: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/41.jpg)
A Python a web service
Using django caching policy
![Page 42: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/42.jpg)
A Python a web service
For throttling, just add: DEFAULT_THROTTLE_CLASSES +
DEFAULT_THROTTLE_RATESin settings.py
![Page 43: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/43.jpg)
A Python a web service
Powerful and extensible object level permissions
![Page 44: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/44.jpg)
A Python a web service
![Page 45: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/45.jpg)
A Python a web service
Depends on Django >get all the Django mess
![Page 46: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/46.jpg)
A Python a web service
Pretty huge
![Page 47: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/47.jpg)
A Python a web service
Can do a lot of black magic
![Page 48: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/48.jpg)
A Python a web service
Rigid
![Page 49: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/49.jpg)
A Python a web service
Django Tastypie
![Page 50: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/50.jpg)
A Python a web service
Plug and play
![Page 51: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/51.jpg)
A Python a web service
Decent auth support
![Page 52: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/52.jpg)
A Python a web service
Documented
![Page 53: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/53.jpg)
A Python a web service
Still supported
![Page 54: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/54.jpg)
A Python a web service
Paginator for pagination
![Page 55: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/55.jpg)
A Python a web service
Validation --- you can extend it
![Page 56: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/56.jpg)
A Python a web service
serializer = Serializer(formats=[‘json’, ‘jsonp’, ‘xml’, ‘yaml’, ‘html’, ‘plist’])
![Page 57: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/57.jpg)
A Python a web service
throttle = BaseThrottle(throttle_at=100)
![Page 58: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/58.jpg)
A Python a web service
NO NO NO
![Page 59: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/59.jpg)
A Python a web service
Not intuitive
![Page 60: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/60.jpg)
A Python a web service
Ugly
![Page 61: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/61.jpg)
A Python a web service
class ParentResource(ModelResource): children = fields.ToManyField(ChildResource, ‘children’)
def prepend_urls(self): return [ url(r”^(?P<resource_name>%s)/(?P<pk>\w[\w/-]*)/children%s$” % (self._meta.resource_name, trailing_slash()), self.wrap_view(‘get_children’), name=”api_get_children”), ] def get_children(self, request, **kwargs): try: bundle = self.build_bundle(data={‘pk’: kwargs[‘pk’]}, request=request) obj = self.cached_obj_get(bundle=bundle, **self.remove_api_resource_names(kwargs)) except ObjectDoesNotExist: return HttpGone() except MultipleObjectsReturned: return HttpMultipleChoices(“More than one resource is found at this URI.”)
child_resource = ChildResource() return child_resource.get_detail(request, parent_id=obj.pk)
![Page 62: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/62.jpg)
A Python a web service
Depends on Django >get all the Django mess
![Page 63: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/63.jpg)
A Python a web service
Can do a lot of black magic
A Python a web service
Can do a lot of black magic
![Page 64: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/64.jpg)
A Python a web service
Rigid
![Page 65: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/65.jpg)
A Python a web service
Flask
![Page 66: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/66.jpg)
A Python a web service
![Page 67: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/67.jpg)
A Python a web service
from flask import Flaskapp = Flask(__name__)
@app.route(“/”)def hello(): return “Hello World!”
if __name__ == “__main__”: app.run()
![Page 68: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/68.jpg)
A Python a web service
Werkzeug, Jinja 2 and good intentions
![Page 69: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/69.jpg)
A Python a web service
Very small and easy to learn(super intuitive)
![Page 70: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/70.jpg)
A Python a web service
Solid and well documented
![Page 71: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/71.jpg)
A Python a web service
Awesome and strong community
![Page 72: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/72.jpg)
A Python a web service
Great debugging tools
![Page 73: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/73.jpg)
A Python a web service
Application dispatcher (on wsgi level)
![Page 74: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/74.jpg)
A Python a web service
Integrating unittest and integration tests (also check flask-testing)
![Page 75: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/75.jpg)
A Python a web service
Signals
![Page 76: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/76.jpg)
A Python a web service
Configuration == dict
![Page 77: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/77.jpg)
A Python a web service
Blueprints
![Page 78: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/78.jpg)
A Python a web service
Response object == wsgi app
![Page 79: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/79.jpg)
A Python a web service
SHOW ME THE SOURCEYOU MUST
![Page 80: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/80.jpg)
A Python a web service
BYOB
![Page 81: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/81.jpg)
A Python a web service
Some batteries
Flask-SQLAlchemy Flask-Testing
Flask-Oauthlib
Flask-Script
Flask-PrincipalFlask-Cache
Flask-Classy
![Page 82: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/82.jpg)
A Python a web service
![Page 83: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/83.jpg)
A Python a web service
Q/A
![Page 84: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/84.jpg)
A Python a web service
Resources
Kenneth ReitzFlask GoodnessAPI Driven DevelopmentHow I develop Things and Why?
Kevin LackerHow to Design Great APIs?
![Page 85: A Python a web service - files.meetup.comfiles.meetup.com/8579852/PyTim #4 Vlad Temian - A Python Web Se… · A Python a web service Tools & Utilities management tools supporting](https://reader033.fdocuments.us/reader033/viewer/2022050204/5f573148d116137e9d114fe3/html5/thumbnails/85.jpg)
A Python a web service
Thank you!
DRINK ALL THE BEERS!