pip install pyyaml
import yaml
class Settings(BaseSettings):
db_url: str
@classmethod
def from_yaml(cls, path: str):
with open(path, 'r') as f:
data = yaml.safe_load(f)
return cls(**data)
settings = Settings.from_yaml('test.yaml')
print(settings.db_url)
from bs4 import BeautifulSoup
h = '''
<div class="searchPersonaInfo">
<a class="searchPersonaName" href="url">Ник</a>
<br>
Алекс
<br>
Murmansk
<img src="img.gif">
</div>
'''
soup = BeautifulSoup(h, 'lxml')
div = soup.find(class_='searchPersonaInfo')
for s in div.stripped_strings:
print(s)
https://sirus.su/api/statistic/tooltip.json
data = json.loads(response.text)
data = response.json()