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 python:3.11.2-slim | |
WORKDIR /opt/project | |
RUN pip3 install --upgrade pip | |
RUN apt-get update && apt-get upgrade -y && apt-get autoremove && apt-get autoclean | |
RUN apt-get install --no-install-recommends -y | |
RUN pip3 install --no-cache-dir poetry | |
COPY ./pyproject.toml /opt/project |
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 os | |
import shutil | |
import time | |
import random | |
from movies.models import * | |
from tqdm import tqdm | |
from users.models import User | |
from model_bakery import baker | |
genre_names = [ |
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 Optional | |
from aioredis import Redis, create_redis_pool | |
class RedisCache: | |
def __init__(self): | |
self.redis_cache: Optional[Redis] = None | |
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 inspect import getmembers, isfunction | |
import os | |
import pkgutil | |
# for example, let's take all the functions of the os module | |
# для примера возьмем все функции модуля OS | |
class CollectFunctions: | |
def __init__(self): | |
self.functions = dict() |
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 {CaseReducer, createSlice, PayloadAction} from "@reduxjs/toolkit"; | |
const ProfileState = { | |
email: '' as string, | |
rating: 0 as number, | |
username: '' as string, | |
first_name: '' as string, | |
last_name: null as string | null, | |
slug: '' as string, | |
avatar: '/static/user.svg' as string, |
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
payHandle(e) { | |
e.preventDefault(); | |
this.myFormTargets.current.value = 'test' | |
this.myForm.current.submit() | |
} | |
<form ref={this.payHandle} className='pay' method="POST" action='https://money.yandex.ru/quickpay/confirm.xml' onSubmit={this.payHandle}> | |
<input type="hidden" name="receiver" value="41001261102xxxx"/> | |
<input type="hidden" name="formcomment" value={boostInfoPay}/> | |
<input type="hidden" name="short-dest" value={boostInfoPay}/> |
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
logging.basicConfig(level=logging.DEBUG) | |
logger = init_logger(__name__, testing_mode=True) | |
logger.debug('Testing mode = True') | |
import logging | |
import colorlog | |
def init_logger(dunder_name, testing_mode) -> logging.Logger: |
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
class BalanceConsumer(AsyncWebsocketConsumer): | |
async def connect(self): | |
self.user = self.scope['user'] | |
if self.user.is_authenticated: | |
# text_data = json.dumps({ | |
# 'message': '99999999' | |
# }) | |
self.user_name = str(self.user.username) | |
await self.channel_layer.group_add( |
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
def status_page(request): | |
if request.method == 'POST': | |
-Магия- | |
email = request.POST.get('email') | |
# сумма которая списана с отправителя | |
withdraw_amount = request.POST.get('withdraw_amount') | |
a = f'{notification_type}&{operation_id}&{amount}&{currency}&{datetime}&{sender}&{codepro}&{notification_secret}&{label}' | |
sha1_hash2 = sha1(f'{a}'.encode('UTF8')).hexdigest() |
NewerOlder