Skip to content

Instantly share code, notes, and snippets.

@slingamn
slingamn / gist:2584138
Created May 3, 2012 08:00
requests cookie test
#!/usr/bin/env python
# coding:utf-8
import urllib
import urllib2
import cookielib
import requests
from requests import session
def get_cookie_from(cj, name):
@slingamn
slingamn / gist:2584020
Created May 3, 2012 07:31
requests cookie test
#!/usr/bin/env python
# coding:utf-8
import urllib
import urllib2
import cookielib
from requests import session
class UClient(object):
import requests
import json
def httpbin(*suffix):
"""Returns url for HTTPBIN resource."""
return 'http://httpbin.org/' + '/'.join(suffix)
s = requests.session()
r = s.get(httpbin('cookies', 'set', 'a', '97'))
assert json.loads(r.text)['cookies'] == {'a': '97'}
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..cbb1d4b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+build
+*.class
+*.swp
diff --git a/clean b/clean
#!/usr/bin/python
"""
BART departure times from the command line. Use it like this:
bart # departure times for Powell St, POWL
bart 24th # departure times for 24th and Mission
bart nbrk # departure times for North Berkeley
"""
#!/usr/bin/python
import sys
import optparse
from xml.dom import minidom
from xml.dom.minidom import parse, parseString
import urllib2
import pprint
BART_DATA_URL = "http://www.bart.gov/dev/eta/bart_eta.xml"
PyObject *
PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
{
#ifdef DXPAIRS
int lastopcode = 0;
#endif
register PyObject **stack_pointer; /* Next free slot in value stack */
register unsigned char *next_instr;
register int opcode; /* Current opcode */
register int oparg; /* Current opcode argument, if any */
diff --git a/ezio/Ezio.h b/ezio/Ezio.h
index 7ff33f1..917fd9f 100644
--- a/ezio/Ezio.h
+++ b/ezio/Ezio.h
@@ -54,27 +54,6 @@ static void array_xdecref(Py_ssize_t num_vars, PyObject *vars[]) {
}
}
-/**
- Basic RAII for PyObject*'s; store a pointer and a new reference, ensure