Click to toggle contents of `code`
CODE!
CODE!
| >>> from cryptography import x509 | |
| >>> from cryptography.hazmat.backends import default_backend | |
| >>> from cryptography.hazmat.primitives import hashes | |
| >>> cert_pem = open( '/tmp/testcert.crt', 'rb' ).read() | |
| >>> cert = x509.load_pem_x509_certificate(cert_pem, default_backend()) | |
| >>> print(cert.public_key()) | |
| <cryptography.hazmat.backends.openssl.ec._EllipticCurvePublicKey object at 0x7fe27d803450> |
| import json | |
| import requests | |
| API_URL = 'https://api.alwaysdata.com/v1/' | |
| API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' | |
| ACCOUNT_NAME = 'account_name' | |
| # Updating a mailbox | |
| mailbox_id = 12345 |
| import socket | |
| # Socket part | |
| ANY = "0.0.0.0" | |
| MCAST_ADDR = "237.252.249.227" | |
| MCAST_PORT = 1600 | |
| #create a UDP socket | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) | |
| #allow multiple sockets to use the same PORT number | |
| sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEPORT, 1) |