No, you can't. To oversimplify - wireless payments (NFC, RFID chips on cards, etc) aren't a simple 'what's your card number' transaction (because that would be insecure beyond belief), they are more of a 'here, encrypt this block of data with your secret numbers and return it' type of thing.
The block of data to be encrypted changes for each transaction, and there's (supposed to be) no way to get the device to spit out it's secret numbers.
So you can't EASILY clone your cards onto your phone (if you could, then so could anyone else who walked near you).
That's not to say it can't be done at all (if, perhaps, you found a flaw in the way the crypto works, you could perhaps deduce the secret numbers of a device), but it's not something you're going be buying an app for.
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?
GenericForeignKey
- позволяет ссылаться на различные объекты и вообще данное решение более универсальное.class Like(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL,
related_name='likes',
on_delete=models.CASCADE)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
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())