Skip to content

Instantly share code, notes, and snippets.

View benburrill's full-sized avatar

Ben Burrill benburrill

  • Looking for a job
View GitHub Profile
@benburrill
benburrill / funcfmt.py
Created November 15, 2015 05:12
Function formatting in Python - see usage
# This is more of an idea than a actual module - although you can use it as such.
# A few things you could do:
# - split the fmt_spec into comma-separated arguments which can be passed into the function
# - make a format method part of the class itself instead of splatting the object into format
class FormatFuncs(dict):
def register(self, func):
self[func.__name__] = type(func.__name__, (), {
"__format__": lambda self, fmt_spec: func(fmt_spec)
})()
import json
import base64
import requests
import mimetypes
import urllib.parse
from pprint import pprint
from requests_oauthlib import OAuth1
CONSUMER_KEY = "INSERT KEY HERE"
CONSUMER_SECRET = "INSERT SECRET HERE"