Skip to content

Instantly share code, notes, and snippets.

View panchambharadwaj's full-sized avatar

Pancham Bharadwaj panchambharadwaj

View GitHub Profile
@panchambharadwaj
panchambharadwaj / heroku_local_intellij.md
Last active August 13, 2020 03:46
Heroku local web debug with Intellij IDEA
@panchambharadwaj
panchambharadwaj / aes_cipher.py
Last active May 24, 2018 15:27 — forked from swinton/AESCipher.py
Encrypt & Decrypt using PyCrypto AES 256
import base64
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
class AESCipher(object):
def __init__(self, length, key):
import urllib
urllib.quote('/', safe='') # '/' used as an example
@panchambharadwaj
panchambharadwaj / requests-exception-handling.py
Last active April 26, 2018 07:57
Graceful way to handle requests exception handling
import requests
try:
r = requests.get('url')
except requests.exceptions.RequestException as e:
print e
@panchambharadwaj
panchambharadwaj / log.py
Last active May 1, 2018 07:40
Logging definition which writes to a file
import logging
import os
from datetime import datetime
class Log(object):
def __init__(self, log_name=os.path.splitext(os.path.basename(__file__))[0], log_level=logging.DEBUG):
self.log_name = log_name
self.log_level = log_level