Skip to content

Instantly share code, notes, and snippets.

@bardal
bardal / jira_auto_login.py
Created June 9, 2020 09:54
Sign into JIRA from Python using your browser's cookies
import jira
import urllib
import browser_cookie3
def jira_login(jira_base_url):
hostname = urllib.parse.urlparse(jira_base_url).hostname
jira_cookies = browser_cookie3.chrome(domain_name=hostname)
cookie_dict= {c.name: c.value for c in jira_cookies}
options = {"server" : jira_base_url, "cookies" : cookie_dict}
return jira.JIRA(options)
@bardal
bardal / evening_appointments.py
Last active November 22, 2019 21:44
Python Outlook automation with win32com - what evening appointments do I have coming up?
import win32com.client, datetime, time
# make sure we've got the outlook constants for Outlook 2010 - 'Microsoft Outlook 14.0 Object Library'
from win32com.client import gencache
gencache.EnsureModule('{00062FFF-0000-0000-C000-000000000046}', 0, 9, 4)
def _com_time_to_datetime(pytime):
return datetime.datetime(month=pytime.month, day=pytime.day, year=pytime.year,
hour=pytime.hour, minute=pytime.minute, second=pytime.second)