def set_wallpaper_request(request): environment = de.get_desktop_environment() i, path = tempfile.mkstemp() with open(path, 'wb') as fo: for chunk in request.iter_content(4096): fo.write(chunk) set_wallpaper(path)
def get_wallpaper_setter(): environment = de.get_desktop_environment() if environment in wallpaper_setters: return wallpaper_setters[environment](environment) return WallpaperSetter(environment)