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
from flask import Flask, request | |
import logging | |
import json | |
from geo import get_country, get_distance, get_coordinates | |
app = Flask(__name__) | |
logging.basicConfig(level=logging.INFO, filename='app.log', format='%(asctime)s %(levelname)s %(name)s %(message)s') | |
@app.route('/post', methods=['POST']) |
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 requests | |
from math import sin, cos, sqrt, atan2, radians | |
def get_coordinates(city): | |
url = "https://geocode-maps.yandex.ru/1.x/" | |
params = { | |
'geocode': city, |
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
from flask import Flask, request | |
import logging | |
import json | |
import random | |
app = Flask(__name__) | |
logging.basicConfig(level=logging.INFO) | |
cities = { |
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
# импортируем библиотеки | |
from flask import Flask, request | |
import logging | |
# библиотека, которая нам понадобится для работы с JSON | |
import json | |
# создаем приложение | |
# мы передаем __name__, в нем содержится информация, в каком модуле мы находимся. | |
# В данном случае там содержится '__main__', так как мы обращаемся к переменной из запущенного модуля. |
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 pytest | |
import sys | |
import solution | |
class TestAggregatorsBase: | |
@pytest.fixture | |
def base_class(self): | |
return None |
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 os | |
import sys | |
import pygame | |
pygame.init() | |
pygame.key.set_repeat(200, 70) | |
FPS = 50 | |
WIDTH = 400 | |
HEIGHT = 300 |
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 os | |
import pygame | |
pygame.init() | |
size = width, height = 800, 400 | |
screen = pygame.display.set_mode(size) | |
def load_image(name, color_key=None): |
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 os | |
import random | |
import pygame | |
def load_image(name, color_key=None): | |
fullname = os.path.join('data', name) | |
try: | |
image = pygame.image.load(fullname).convert() | |
except pygame.error as message: |
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 os | |
import random | |
import pygame | |
size = width, height = 400, 300 | |
screen = pygame.display.set_mode(size) | |
def load_image(name, color_key=None): | |
fullname = os.path.join('data', name) | |
image = pygame.image.load(fullname).convert() |
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 os | |
import random | |
import pygame | |
def load_image(name, color_key=None): | |
fullname = os.path.join('data', name) | |
try: | |
image = pygame.image.load(fullname).convert() |
NewerOlder