python-dependency-injector/examples/miniapps/services/example/main.py

28 lines
809 B
Python
Raw Normal View History

2016-09-18 23:00:10 +03:00
"""Example main module."""
2016-10-06 22:48:43 +03:00
def main(uid, password, photo, users_service, auth_service, photos_service):
2016-11-12 00:08:47 +03:00
"""Authenticate user and upload photo.
:param uid: User identifier.
:type uid: int
:param password: User's password for verification.
:type password: str
:param photo_path: Path to photo for uploading.
:type photo_path: str
:param users_service: Users service.
:type users_service: example.services.UsersService
:param auth_service: Authentication service.
:type auth_service: example.services.AuthService
:param photo_service: Photo service.
:type photo_service: example.services.PhotoService
"""
2016-10-06 22:48:43 +03:00
user = users_service.get_user_by_id(uid)
auth_service.authenticate(user, password)
photos_service.upload_photo(user['uid'], photo)