- if kwargs:
- argStr = "?" + "&".join([
- "%s=%s" %(k, v) for k, v in kwargs.iteritems()])
- c = httplib.HTTPConnection("twitter.com")
+ argData = None
+ if (method == "GET"):
+ if self.encoded_args:
+ argStr = "?%s" %(self.encoded_args)
+ else:
+ argData = self.encoded_args
+
+ headers = {}
+ if (self.agent):
+ headers["X-Twitter-Client"] = self.agent
+ if (self.username):
+ headers["Authorization"] = "Basic " + b64encode("%s:%s" %(
+ self.username, self.password))
+
+ secure_str = ''
+ if self.secure:
+ secure_str = 's'
+
+ req = urllib2.Request(
+ "http%s://%s/%s.%s%s" %(
+ secure_str, self.domain, uri, self.format, argStr),
+ argData, headers)
+