Добавлен новый метод — listdir
This commit is contained in:
@@ -6,7 +6,7 @@ from bs4 import BeautifulSoup
|
||||
from pprint import pprint
|
||||
from time import sleep
|
||||
import requests
|
||||
from os import mkdir
|
||||
from os import mkdir, listdir
|
||||
from os.path import exists
|
||||
from cerberus import Validator
|
||||
|
||||
@@ -18,6 +18,14 @@ class Pars:
|
||||
if not v.validate(expected):
|
||||
raise ValueError(v.errors)
|
||||
|
||||
def listdir(self, path: str) -> dict:
|
||||
'''Возвращает список файлов в указанной директории'''
|
||||
schema = {'path': {'type': 'string'}}
|
||||
expected = {'path': path}
|
||||
self.__validation(schema, expected)
|
||||
|
||||
return listdir(path)
|
||||
|
||||
def mkdir(self, nameDir: str):
|
||||
'''Создаёт папку если её ещё нет
|
||||
|
||||
|
||||
Reference in New Issue
Block a user