This file contains hidden or 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 botocore.vendored import requests | |
from urllib.parse import parse_qs | |
def lambda_handler(event, context): | |
data=parse_qs(event['params'])#параметры приходят согласно настройкам меппинга в гетавее | |
event=data['event'][0] | |
key=data['auth[application_token]'][0] | |
This file contains hidden or 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
def http_build_query(params, topkey = ''): | |
from urllib.parse import quote | |
if len(params) == 0: | |
return "" | |
result = "" | |
# is a dictionary? | |
if type (params) is dict: |
This file contains hidden or 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 zeep import Client | |
def lambda_handler(event, context): | |
url = 'https://tracking.russianpost.ru/rtm34?wsdl' | |
barcode = event['barcode'] | |
my_login = '****************' | |
my_password = '**************' | |
This file contains hidden or 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 botocore.vendored import requests | |
def lambda_handler(event, context): | |
ib_id=event['ib_id'] | |
el_id=event['id'] | |
data={ | |
'IBLOCK_TYPE_ID': 'lists', |
This file contains hidden or 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 zeep import Client | |
from botocore.vendored import requests | |
from urllib.parse import parse_qs | |
def lambda_handler(event, context): | |
url = 'https://tracking.russianpost.ru/rtm34?wsdl' | |
barcode = event['barcode'] | |
my_login = '************' |
This file contains hidden or 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
secrets_list = [] | |
response = self._lambda_client.list_secrets() | |
for secrets_dict in response['SecretList']: | |
secrets_list.append(secrets_dict) | |
while "NextMarker" in response: | |
response = self._lambda_client.list_secrets( | |
Marker=response["NextMarker"]) | |
for secrets_dict in response['SecretList']: | |
secrets_list.append(secrets_dict) |
This file contains hidden or 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
config_delegator = ConfigDelegator(event["resultToken"], CONFIG_CLIENT) | |
config_delegator.add_evaluation( | |
answer["type"], answer["annotation"], item['Name'], self._resource_type) |
This file contains hidden or 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
{ | |
"invokingEvent": "{\"configurationItem\":{\"configurationItemCaptureTime\":\"2016-02-17T01:36:34.043Z\",\"awsAccountId\":\"123456789012\",\"configurationItemStatus\":\"OK\",\"resourceId\":\"i-00000000\",\"ARN\":\"arn:aws:ec2:us-east-2:123456789012:instance/i-00000000\",\"awsRegion\":\"us-east-2\",\"availabilityZone\":\"us-east-2a\",\"resourceType\":\"AWS::EC2::Instance\",\"tags\":{\"Foo\":\"Bar\"},\"relationships\":[{\"resourceId\":\"eipalloc-00000000\",\"resourceType\":\"AWS::EC2::EIP\",\"name\":\"Is attached to ElasticIp\"}],\"configuration\":{\"foo\":\"bar\"}},\"messageType\":\"ConfigurationItemChangeNotification\"}", | |
"ruleParameters": "{\"myParameterKey\":\"myParameterValue\"}", | |
"resultToken": "myResultToken", | |
"eventLeftScope": false, | |
"executionRoleArn": "arn:aws:iam::123456789012:role/config-role", | |
"configRuleArn": "arn:aws:config:us-east-2:123456789012:config-rule/config-rule-0123456", | |
"configRuleName": "change-triggered-config-rule", | |
"configRuleId": "config-rule-01234 |
This file contains hidden or 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
@staticmethod | |
def prepare_report(item): | |
"""Prepare report for answer to AWS Config""" | |
rotation_arn = item['RotationLambdaARN'] | |
aa_days = item['RotationRules']['AutomaticallyAfterDays'] | |
secret_name = item['Name'] | |
if not rotation_arn: | |
answer = { |
This file contains hidden or 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
def add_b24_product(key, name, price, file_name, file_url): | |
import requests | |
import base64 | |
image_64_encode = str(base64.b64encode(requests.get(file_url).content))[2:-1] | |
product_data = { | |
"fields" : { | |
"iblockId": 1, |
OlderNewer