Skip to content

Instantly share code, notes, and snippets.

View rafaeldalsenter's full-sized avatar
🚀

Rafael Dalsenter rafaeldalsenter

🚀
  • Brazil
View GitHub Profile
aws_ext.delete_object_if_exists(bucketNameDest, archiveNameDest)
binary = BytesIO()
for page in objects.page_size(amount_objects).pages():
zip_file = aws_ext.get_object_summary(bucketNameDest, archiveNameDest)
print("Upload +{} files to {}...".format(amount_objects, archiveNameDest))
link = aws_ext.link_from_object(bucketNameDest, archiveNameDest)
return function_return(True, "Bucket successfully compressed!", link)
name: Lambda deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
version: '3'
services:
db-postgres:
image: postgres
container_name: db-postgres
environment:
POSTGRES_PASSWORD: "postgres"
ports:
- "5432:5432"
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=postgres;User ID=postgres;Password=postgres",
"MongoConnection": "mongodb://root:root@localhost:27017"
}
}
public class CreateClienteCommand : IRequest<CommandReturnDto>
{
public string Nome { get; private set; }
public string Cpf { get; private set; }
public string Rua { get; private set; }
public string Bairro { get; private set; }
public string Cidade { get; private set; }
public string Observacoes { get; private set; }
public CreateClienteCommand(string nome, string cpf, string rua, string bairro, string cidade, string obs)
public class CreateClienteCommandHandler : IRequestHandler<CreateClienteCommand, CommandReturnDto>
{
public CreateClienteCommandHandler(/*Repositories por injeção de dependência*/)
{
}
public Task<CommandReturnDto> Handle(CreateClienteCommand request, CancellationToken cancellationToken)
{
// Insere nos bancos de dados e retorna o CommandReturnDto
}
public static void RegisterServices(IServiceCollection services, IConfiguration configuration)
{
...
services.AddScoped<IRequestHandler<CreateClienteCommand, CommandReturnDto>, CreateClienteCommandHandler>();
services.AddScoped<IRequestHandler<RemoveClienteCommand, CommandReturnDto>, RemoveClienteCommandHandler>();
services.AddScoped<IRequestHandler<UpdateClienteCommand, CommandReturnDto>, UpdateClienteCommandHandler>();
}
public class ClienteServices : IClienteServices
{
private readonly IMediator _mediator;
private readonly IMapper _mapper;
private readonly IClienteForQueryRepository _clienteForQueryRepository;
public ClienteServices(IMediator mediator,
IMapper mapper,
IClienteForQueryRepository clienteForQueryRepository)
{
from urllib.request import Request, urlopen
from bs4 import BeautifulSoup
URL_STOCKS_LIST = 'https://www.infomoney.com.br/cotacoes/empresas-b3/'
HEADER_BASE = {'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36'}
class Scraping:
...
def set_urls(self, list):