Skip to content

Instantly share code, notes, and snippets.

@zhangcheng
Last active December 17, 2015 11:59
Show Gist options
  • Save zhangcheng/5606578 to your computer and use it in GitHub Desktop.
Save zhangcheng/5606578 to your computer and use it in GitHub Desktop.
Snippets
import wsgi_intercept
import wsgi_intercept.mechanize_intercept
from wsgi_intercept.test_wsgi_app import create_fn
wsgi_intercept.add_wsgi_intercept('some_host', 80, create_fn)
b = wsgi_intercept.mechanize_intercept.Browser()
response = b.open('http://some_host:80')
response.read()
import wsgi_intercept
import wsgi_intercept.mechanize_intercept
from django.core.handlers.wsgi import WSGIHandler
wsgi_intercept.add_wsgi_intercept('localhost', 17681, WSGIHandler)
b = wsgi_intercept.mechanize_intercept.Browser()
b.set_handle_robots(False)
b.open('http://localhost:17681/account/login/')
b.select_form(nr=1)
b.form['username'] = 'zhangcheng@appannie.com'
b.form['password'] = 'admin'
response = b.submit()
response.read()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment