Skip to content

Instantly share code, notes, and snippets.

import time
from authlib.integrations.requests_client import OAuth2Session
import signer
NA_AUTH_URI = "https://api.amazon.com/auth/o2/token"
EU_AUTH_URI = "https://api.amazon.co.uk/auth/o2/token"
FE_AUTH_URI = "https://api.amazon.co.jp/auth/o2/token"
ONE_HOUR = 3600
from validate import dataclass, field, types, ValidationError
@dataclass
class User:
name: str
surname: str
age: int
email: str = field(validate=types.Email)

GET Keyword entity

GET /amazon/sp/ad_groups/123/keywords/

{
"kind": "collection",
"self": "/amazon/sp/ad_groups/123/keywords/",
"parent": "/amazon/sp/ad_groups/123/",
"items": [

{

import os
import shutil
import timeit
from dotenv import load_dotenv
from aaapi import api
load_dotenv()
from sqlalchemy import Column, Index, Text
from sqlalchemy.dialects.postgresql import TIMESTAMP
from sqlalchemy.dialects.postgresql.json import JSONB
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Products(Base):
__tablename__ = "products"
import os
import asyncio
from authlib.integrations.httpx_client import AsyncOAuth2Client
from httpx import BasicAuth
AAAPI_TOKEN_URL = os.environ["AAAPI_TOKEN_URL"]
AAAPI_BASE_URI = os.environ["AAAPI_BASE_URI"]
CLIENT_SECRET = os.environ["CLIENT_SECRET"]
[tool.poetry]
name = "django-jwt"
version = "0.1.0"
description = ""
authors = ["Christian Espinoza <chespinoza@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.7"
django = "^3.0.1"
djangorestframework = "^3.11.0"
import json
import boto3
import os
client = boto3.client('cognito-idp')
def lambda_handler(event, context):
if (event['triggerSource'] == 'UserMigration_Authentication'):
user = client.admin_initiate_auth(
UserPoolId=os.environ["USER_POOL_ID"],
"python.formatting.provider": "black",
"python.formatting.blackArgs": [
"--line-length",
"120"
],
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"editor.fontFamily": "'Source Code Pro', 'Courier New', monospace",
"terminal.integrated.fontFamily": "Menlo for Powerline",
"browser-preview.chromeExecutable": "\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\"",
@chespinoza
chespinoza / .spacemacs
Created September 7, 2019 16:37
Spacemacs config
;; -*- mode: emacs-lisp -*-
;; This file is loaded by Spacemacs at startup.
;; It must be stored in your home directory.
(defun dotspacemacs/layers ()
"Configuration Layers declaration.
You should not put any user code in this function besides modifying the variable
values."
(setq-default
;; Base distribution to use. This is a layer contained in the directory