Example #1
0
from app.schemas.schema import ParseCity, FlatDBEntity
from app.settings.paths import TMP_PATH
from app.settings.settings import Settings
from app.utils.utils import (
    generate_date,
    count_psm,
    extract_area,
    JSONEncoder,
    serialize_datetime_to_dict,
)

matplotlib.use("Agg")

import matplotlib.pyplot as plt

settings = Settings()


def set_values(url, **kwargs):
    for k, v in kwargs.items():
        if k == "city_name":
            url += f"&q={v}"
        else:
            url += f"&{k}={v}"
    return url


async def make_request(data):
    request_url = set_values(
        settings.AUTHORIZED_ADS_API_URL,
        category_id=2,
Example #2
0
from time import sleep

import grpc

import app.greet_pb2 as greet_pb2
import app.greet_pb2_grpc as greet_pb2_grpc
from app.settings.settings import Settings

PORT = Settings().GRPC_PORT

while True:
    try:
        with grpc.insecure_channel(f"127.0.0.1:{PORT}") as channel:
            stub = greet_pb2_grpc.GreeterStub(channel)
            response = stub.SayHello(
                greet_pb2.HelloRequest(name='Wonderful Person'))
            print("Greeter client received: " + response.message)
    except:
        pass
    sleep(5)