Created
January 26, 2016 12:07
-
-
Save boyxuper/bcdd811a540405feab0d to your computer and use it in GitHub Desktop.
urllib3==1.14 AttributeError: 'bool' object has no attribute 'close'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib3.poolmanager | |
pool = urllib3.poolmanager.HTTPConnectionPool('127.0.0.1', 9900) | |
resp = pool.urlopen('GET', '/', timeout=1) | |
print resp.data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import time | |
import socket | |
s = socket.socket() | |
s.bind(('', 9900)) | |
while True: | |
s.listen(1) | |
cs, addr = s.accept() | |
print cs.recv(65535) | |
cs.send('''HTTP/1.0 200 OK\n\n''') | |
time.sleep(3) | |
cs.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment