This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from timeit import default_timer as timer | |
import csv | |
from redis import ConnectionPool, Redis | |
__REDIS_HOST = '' | |
__PAGE_SIZE = 500 | |
__OUTPUT_FILE_NAME = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List, Dict | |
from boto3 import resource | |
class SqsClient: | |
__slots__ = ['boto_resource', 'max_number_of_messages', 'pool_wait_time_seconds'] | |
boto_resource: resource | |
max_number_of_messages: int | |
pool_wait_time_seconds: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from boto3 import client | |
class S3Client: | |
__slots__ = ['boto_client', 'bucket_name', 'default_content_type', 'default_acl_type'] | |
boto_client: client | |
bucket_name: str | |
default_content_type: str | |
default_acl_type: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import List | |
from confluent_kafka import Consumer, Message | |
from app.common.converters import try_convert_bytes_to_a_string | |
class KafkaConsumerClient: | |
__slots__ = ['servers', | |
'client_id', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Dict | |
from requests import Session | |
from requests.exceptions import RequestException | |
class BaseApiClient: | |
__slots__ = ['uri', 'timeout', 'headers', 'session'] | |
uri: str | |
timeout: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib | |
import re | |
def lambda_handler(event, context): | |
if 'cep' in event and _regex(event['cep']): | |
return json.loads(urllib.request.urlopen(_get_url_api(event['cep'])).read()) | |
return json.loads("{\"erro\": true, \"mensagem\": \"Formato incorreto\"}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
import re | |
s3 = boto3.client('s3') | |
def lambda_handler(event, context): | |
if 'Records' in event: | |
bucket_object = event['Records'][0]['s3']['bucket']['name'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Using SDK | |
var aws = require('aws-sdk'); | |
var s3 = new aws.S3(); | |
//Define quais extensões serão aceitas no bucket | |
var _extensionsAllowed = ["txt", "csv"]; | |
//Define tamanho máximo e mínimo que serão aceitos (em bytes) | |
var _minFileSize = 20; var _maxFileSize = (1024*1024*2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aws = require('aws-sdk'); | |
var s3 = new aws.S3(); | |
exports.handler = (event, context, callback) => { | |
//Verifica se o objeto existe (chamada através de evento no S3) | |
if ((event) && (event.Records) && (event.Records[0]) && (event.Records[0].s3) && (event.Records[0].s3.bucket) && (event.Records[0].s3.object)){ | |
//Recupera informações de bucket e do objeto | |
var _bucket = event.Records[0].s3.bucket.name; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var aws = require('aws-sdk'); | |
exports.handler = (event, context, callback) => { | |
var _returnMessage = ""; | |
var _destinationAddress, _sourceAddress = '[email protected]'; | |
var _defaultSubject = '[Subject]'; | |
var _defaultMessageData = '[Empty Message]'; | |
//params SES |
NewerOlder