async def on_startup(bot: Bot) -> None:
await print('it's working!')
def main() -> None:
dp = Dispatcher()
dp.include_router(router)
dp.startup.register(on_startup)
bot = Bot(TOKEN, parse_mode=ParseMode.HTML)
app = web.Application()
webhook_requests_handler = SimpleRequestHandler(
dispatcher=dp,
bot=bot,
secret_token=WEBHOOK_SECRET,
)
webhook_requests_handler.register(app, path=WEBHOOK_PATH)
setup_application(app, dp, bot=bot)
web.run_app(app, host=WEB_SERVER_HOST, port=WEB_SERVER_PORT)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO, stream=sys.stdout)
main()
File "/Users/admin/PycharmProjects/im bot/im bot.py", line 15, in send_to_admin
admin_chat_id
? я надеюсь не xxx
, как у вас указано.admin_chat_id
def controls(self, event):
if event.type == pg.KEYDOWN:
bt = pg.key.get_pressed()
if bt[pg.K_SPACE] and self.on_ground:
self.jump()
elif bt[pg.K_d]:
self.walk("right")
elif bt[pg.K_a]:
self.walk('left')
elif bt[pg.K_w]:
self.jerk()
elif event.type == pg.MOUSEBUTTONDOWN:
print("attack")
self.attack()
else:
self.animation("base")
for event in pg.event.get():
do_event(event)
Я использовал Postman для этой задачи, просто удобнее, когда всё наглядно и с user-friendly интерфейсом
from selenium import webdriver
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
browser = webdriver.Chrome(options=chrome_options)
try:
browser.get("https://www.google.com")
print("Page title was '{}'".format(browser.title))
finally:
browser.quit()
app.exec_()
# Main class
class MainClass():
def __init__(self):
# этот webdriver передаётся в другие классы. можно считать, что он "главный"
self.webdriver = None
self.number_of_class = "Main"
class SubClass(MainClass):
def __init__(self, number):
self.number_of_class = number
webdrivers = [SubClass("first_class"), SubClass("second_class"), SubClass("third_class")]