Skip to content

Instantly share code, notes, and snippets.

View echohack's full-sized avatar
🎥
twitch.tv/echohack

echohack echohack

🎥
twitch.tv/echohack
View GitHub Profile
import socket
import inject_exception
import requests
from mock import patch
import nose.tools
# ...snippet
def test_api_call():
with patch.object(requests, "get") as get_mock:
import socket
import requests
# ...snippet
def call_api(url):
try:
requests.get(url="url")
except:
socket.error as e:
@echohack
echohack / myprint.py
Created January 13, 2013 05:14
A short bit of code to test a SublimeText Python developer environment.
class MyPrint:
def __init__(self):
pass
def myPrint(self):
for item in range(10):
print("This is the item at " + str(item) + " .")
return True