I would like to encrypt a secret text by public-key and decrypt it by private-key in Python. I can achieve that with the openssl command:
openssl
Probably the easiest way to get exactly the same behaviour would be using pyOpenSSL - it's a thin Python wrapper for OpenSSL itself.