Esempio n. 1
0
    def __call__(self):

        files = (NVPair("self", "form.py"), )
        parameters = (NVPair("run number", str(grinder.runNumber)), )

        # This is the Jython way of creating an NVPair[] Java array
        # with one element.
        headers = zeros(1, NVPair)

        # Create a multi-part form encoded byte array.
        data = Codecs.mpFormDataEncode(parameters, files, headers)
        grinder.logger.output("Content type set to %s" % headers[0].value)

        # Call the version of POST that takes a byte array.
        result = request1.POST("/upload", data, headers)
Esempio n. 2
0
    def __call__(self):

        files = ( NVPair("self", "form.py"), )
        parameters = ( NVPair("run number", str(grinder.runNumber)), )

        # This is the Jython way of creating an NVPair[] Java array
        # with one element.
        headers = zeros(1, NVPair)

        # Create a multi-part form encoded byte array.
        data = Codecs.mpFormDataEncode(parameters, files, headers)
        grinder.logger.output("Content type set to %s" % headers[0].value)

        # Call the version of POST that takes a byte array.
        result = request1.POST("/upload", data, headers)
Esempio n. 3
0
  def auth(self):
    
    authtext = Codecs.base64Encode('%s\x00%s\x00%s' % (self.username + '@' + domain, self.username, self.password)).strip()
    log("authtext: " + authtext)
    #if authtext[-1] == '\n':
	#  authtext = authtext[:-1]
    
    result = request201.POST('',
      '<body xmlns=\"http://jabber.org/protocol/httpbind\" rid=\"' + str(self.rid) + '\" sid=\"' + self.sid + '\"><auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">' + authtext + '</auth></body>',
      ( NVPair('Content-Type', 'text/plain; charset=utf-8'), ))
    
    self.rid += 1
    
    log("auth response: %s" % result.getText())

    return result
Esempio n. 4
0
    def auth(self):

        authtext = Codecs.base64Encode(
            '%s\x00%s\x00%s' % (self.username + '@' + domain, self.username,
                                self.password)).strip()
        log("authtext: " + authtext)
        #if authtext[-1] == '\n':
        #  authtext = authtext[:-1]

        result = request201.POST(
            '', '<body xmlns=\"http://jabber.org/protocol/httpbind\" rid=\"' +
            str(self.rid) + '\" sid=\"' + self.sid +
            '\"><auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">'
            + authtext + '</auth></body>',
            (NVPair('Content-Type', 'text/plain; charset=utf-8'), ))

        self.rid += 1

        log("auth response: %s" % result.getText())

        return result