Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: third_party/twisted_8_1/twisted/web/google.py

Issue 12261012: Remove third_party/twisted_8_1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/twisted_8_1/twisted/web/error.py ('k') | third_party/twisted_8_1/twisted/web/guard.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/twisted_8_1/twisted/web/google.py
diff --git a/third_party/twisted_8_1/twisted/web/google.py b/third_party/twisted_8_1/twisted/web/google.py
deleted file mode 100644
index a0b8e8f073cf7b2e96378ad5bbb0a0b631a3d23f..0000000000000000000000000000000000000000
--- a/third_party/twisted_8_1/twisted/web/google.py
+++ /dev/null
@@ -1,75 +0,0 @@
-# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-#
-"""\"I'm Feeling Lucky\" with U{Google<http://google.com>}.
-"""
-import urllib
-from twisted.internet import protocol, reactor, defer
-from twisted.web import http
-
-class GoogleChecker(http.HTTPClient):
-
- def connectionMade(self):
- self.sendCommand('GET', self.factory.url)
- self.sendHeader('Host', self.factory.host)
- self.sendHeader('User-Agent', self.factory.agent)
- self.endHeaders()
-
- def handleHeader(self, key, value):
- key = key.lower()
- if key == 'location':
- self.factory.gotLocation(value)
-
- def handleStatus(self, version, status, message):
- if status != '302':
- self.factory.noLocation(ValueError("bad status"))
-
- def handleEndHeaders(self):
- self.factory.noLocation(ValueError("no location"))
-
- def handleResponsePart(self, part):
- pass
-
- def handleResponseEnd(self):
- pass
-
- def connectionLost(self, reason):
- self.factory.noLocation(reason)
-
-
-class GoogleCheckerFactory(protocol.ClientFactory):
-
- protocol = GoogleChecker
-
- def __init__(self, words):
- self.url = ('/search?q=%s&btnI=%s' %
- (urllib.quote_plus(' '.join(words)),
- urllib.quote_plus("I'm Feeling Lucky")))
- self.agent="Twisted/GoogleChecker"
- self.host = "www.google.com"
- self.deferred = defer.Deferred()
-
- def clientConnectionFailed(self, _, reason):
- self.noLocation(reason)
-
- def gotLocation(self, location):
- if self.deferred:
- self.deferred.callback(location)
- self.deferred = None
-
- def noLocation(self, error):
- if self.deferred:
- self.deferred.errback(error)
- self.deferred = None
-
-
-def checkGoogle(words):
- """Check google for a match.
-
- @returns: a Deferred which will callback with a URL or errback with a
- Failure.
- """
- factory = GoogleCheckerFactory(words)
- reactor.connectTCP('www.google.com', 80, factory)
- return factory.deferred
« no previous file with comments | « third_party/twisted_8_1/twisted/web/error.py ('k') | third_party/twisted_8_1/twisted/web/guard.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698