print(event.obj.fwd_messages[0]['from_id'])
PIL.ImageFont.truetype(font=None, size=10, index=0, encoding='', layout_engine=None)
Жаль, что это совершенно другой модуль.
The Python Imaging Library, or PIL for short, is one of the core libraries for image manipulation in Python. Unfortunately, its development has stagnated, with its last release in 2009.
Luckily for you, there’s an actively-developed fork of PIL called Pillow – it’s easier to install, runs on all major operating systems, and supports Python 3.
import random
items = ['one', 'two', 'three', 'four', 'five']
random.choice(items)
бот продаёт кошельки
#!/usr/bin/env python3
# driver_test.py
import os
import sys
sys.path.append(os.path.abspath('../util'))
import driver
drv = driver.Driver()
import base58 # Base58 decoding: https://github.com/keis/base58
def bech32_decode(bech):
charset = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"
if ((any(ord(x) < 33 or ord(x) > 126 for x in bech)) or
(bech.lower() != bech and bech.upper() != bech)):
return False
bech = bech.lower()
pos = bech.rfind('1')
if pos < 1 or pos + 7 > len(bech) or len(bech) > 90:
return False
if not all(x in charset for x in bech[pos+1:]):
return False
hrp = bech[:pos]
data = [charset.find(x) for x in bech[pos+1:]]
if not bech32_verify_checksum(hrp, data):
return False
return True
def is_ltc_address(address):
if len(address) > 43 or len(address) < 26:
return False
if address[0] == "L": # Legacy Non-P2SH Address
return base58.b58decode_check(address)
elif address[0] == "3": # P2SH Address - Deprecated
return False
elif address[0] == "M": # P2SH Address
return base58.b58decode_check(address)
elif address[:4] == "ltc1": # P2WPKH Bech32 (Segwit)
return bech32_decode(address)
return False
C:\Users\finni\AppData\Local\Programs\Python\Python37-32\python.exe C:\Users\finni\Desktop\hello.py
with open('workfile') as f:
... read_data = f.read()
Пользователю необходимо предоставить доступ к определенной директории на сервере, откуда он может выбрать файл, который он хочет скачать.
def make_tree(path):
tree = dict(name=path, children=[])
try: lst = os.listdir(path)
except OSError:
pass #ignore errors
else:
for name in lst:
fn = os.path.join(path, name)
if os.path.isdir(fn):
tree['children'].append(make_tree(fn))
else:
tree['children'].append(dict(name=fn))
return tree
@app.route('/uploads/<path:filename>', methods=['GET', 'POST'])
def download(filename):
uploads = os.path.join(current_app.root_path, app.config['UPLOAD_FOLDER'])
return send_from_directory(directory=uploads, filename=filename)
Как добавить лайки в telegram?
requests.get
зачем get если там должен быть post?curl -X POST \
-H 'Content-Type: application/json' \
-d '{"chat_id": "888888", "text": "This is a test message from curl", "disable_notification": true}' \
https://api.telegram.org/bot$TELEGRAM_BOT_TOKEN/sendMessage
import requests
import json
proxy = {'https': 'socks5h://user:password@IP:1080'}
token = '8888:ABC'
chat_id = 88888
URL = 'https://api.telegram.org/bot' + token + '/sendMessage'
reply_markup ={ "keyboard": [["Yes", "No"], ["Maybe"], ["1", "2", "3"]], "resize_keyboard": True}
data = {'chat_id': chat_id, 'text': '123', 'reply_markup': json.dumps(reply_markup)}
r = requests.post(URL, data=data, proxies=proxy)
print(r.json())
Эта ошибка возникает на нашей стороне, у нас на серверах. Стоит чуть-чуть подождать и повторить запрос снова. Если она раз за разом повторяется, нужно связаться с нами.