Skip to content

Commit d5ca91f

Browse files
committed
nicened up firebase.py
1 parent b34187c commit d5ca91f

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

firebase.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ def close(self):
3232
# HACK: dig through the sseclient library to the requests library down to the underlying socket.
3333
# then close that to raise an exception to get out of streaming. I should probably file an issue w/ the
3434
# requests library to make this easier
35-
self.resp.raw._fp.fp._sock.shutdown(socket.SHUT_RDWR)
36-
self.resp.raw._fp.fp._sock.close()
35+
try:
36+
self.resp.raw._fp.fp._sock.shutdown(socket.SHUT_RDWR)
37+
self.resp.raw._fp.fp._sock.close()
38+
except AttributeError:
39+
pass
3740

3841
class RemoteThread(threading.Thread):
3942
def __init__(self, URL, function):
@@ -83,14 +86,19 @@ def put(URL, msg):
8386
if response.status_code != 200:
8487
raise Exception(response.text)
8588

86-
def push(URL, msg):
89+
def patch(URL, msg):
8790
to_post = json.dumps(msg)
88-
response = requests.post(firebaseURL(URL), data = to_post)
91+
response = requests.patch(firebaseURL(URL), data = to_post)
8992
if response.status_code != 200:
9093
raise Exception(response.text)
9194

92-
def patch(URL, msg):
95+
96+
'''
97+
Yuck, I don't want to write documentation for this :p
98+
def push(URL, msg):
9399
to_post = json.dumps(msg)
94-
response = requests.patch(firebaseURL(URL), data = to_post)
100+
response = requests.post(firebaseURL(URL), data = to_post)
95101
if response.status_code != 200:
96102
raise Exception(response.text)
103+
'''
104+

firebase.pyc

4.03 KB
Binary file not shown.

0 commit comments

Comments
 (0)