python类HTTPException()的实例源码

__init__.py 文件源码 项目:Taigabot 作者: FrozenPigs 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = str(response.status_code)
        self.response['reason'] = httplib.responses.get(response.status_code, 'Ok')
        self.response.status = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
sendDataToThingSpeak.py 文件源码 项目:Micro-bit 作者: ArcherHuang 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def post_to_thingspeak(payload):
    headers = {"Content-type": "application/x-www-form-urlencoded","Accept": "text/plain"}
    not_connected = 1
    while (not_connected):
        try:
            conn = httplib.HTTPConnection("api.thingspeak.com:80")
            conn.connect()
            not_connected = 0
        except (httplib.HTTPException, socket.error) as ex:
            print "Error: %s" % ex
            time.sleep(10)  # sleep 10 seconds

    conn.request("POST", "/update", payload, headers)
    response = conn.getresponse()
    print( response.status, response.reason, payload, time.strftime("%c"))
    data = response.read()
    conn.close()
sendDataToMCS.py 文件源码 项目:Micro-bit 作者: ArcherHuang 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def post_to_mcs(payload):
    headers = {"Content-type": "application/json", "deviceKey": deviceKey}
    not_connected = 1
    while (not_connected):
        try:
            conn = httplib.HTTPConnection("api.mediatek.com:80")
            conn.connect()
            not_connected = 0
        except (httplib.HTTPException, socket.error) as ex:
            print "Error: %s" % ex
            time.sleep(10)  # sleep 10 seconds

    conn.request("POST", "/mcs/v2/devices/" + deviceId + "/datapoints", json.dumps(payload), headers)
    response = conn.getresponse()
    print( response.status, response.reason, json.dumps(payload), time.strftime("%c"))
    data = response.read()
    conn.close()
__init__.py 文件源码 项目:Intranet-Penetration 作者: yuxiaokui 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = str(response.status_code)
        self.response['reason'] = httplib.responses.get(response.status_code, 'Ok')
        self.response.status = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
__init__.py 文件源码 项目:MKFQ 作者: maojingios 项目源码 文件源码 阅读 35 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = str(response.status_code)
        self.response['reason'] = httplib.responses.get(response.status_code, 'Ok')
        self.response.status = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
home.py 文件源码 项目:aerospike-telemetry-agent 作者: aerospike 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def postInfo(self, requestParams):
        logging.info("About to phone home to [%s].", self.url)

        req = urllib2.Request(self.url)
        req.add_header('Content-Type', 'application/json')
        resp = None

        try:
            resp = urllib2.urlopen(req, json.dumps(requestParams), timeout = 30, **self.kwargs)
            resp = resp.read()
        except urllib2.HTTPError, e:
            logging.error("HTTPError: %s", str(e.code))
        except urllib2.URLError, e:
            logging.error("URLError: %s", str(e.reason))
        except httplib.HTTPException, e:
            logging.error("HTTPException: %s", str(e))
        except Exception, e:
            logging.exception("Unexpected error: %s", str(e))

        return resp
__init__.py 文件源码 项目:edx-video-pipeline 作者: edx 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
ckanharvester.py 文件源码 项目:dati-ckan-docker 作者: italia 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def _get_content(self, url):
        http_request = urllib2.Request(url=url)

        api_key = self.config.get('api_key')
        if api_key:
            http_request.add_header('Authorization', api_key)

        try:
            http_response = urllib2.urlopen(http_request)
        except urllib2.HTTPError, e:
            if e.getcode() == 404:
                raise ContentNotFoundError('HTTP error: %s' % e.code)
            else:
                raise ContentFetchError('HTTP error: %s' % e.code)
        except urllib2.URLError, e:
            raise ContentFetchError('URL error: %s' % e.reason)
        except httplib.HTTPException, e:
            raise ContentFetchError('HTTP Exception: %s' % e)
        except socket.error, e:
            raise ContentFetchError('HTTP socket error: %s' % e)
        except Exception, e:
            raise ContentFetchError('HTTP general exception: %s' % e)
        return http_response.read()
request.py 文件源码 项目:webdirfuzz 作者: Fenguopeng 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def send_http(self, url):
        o = urlparse(url)
        r = 0
        try:
            conn = httplib.HTTPConnection(o[1], timeout=self.timeout)
            if o[4]:
                conn.request('GET', o[2] + o[3] + '?' + o[4], headers=self.headers)
            else:
                conn.request('GET', o[2] + o[3], headers=self.headers)
            r = conn.getresponse()
            logger.info('%s %s' % (url, r.status))
            time.sleep(self.delay)
        except (httplib.HTTPException, socket.timeout, socket.gaierror, Exception), e:
            logger.error('url %s is unreachable, Exception %s %s' % (url, e.__class__.__name__, e))
            print 'url %s is unreachable, Exception %s %s' % (url.encode('utf-8'), e.__class__.__name__, e)
            pass
        return r
httplib2.py 文件源码 项目:catchup4kodi 作者: catchup4kodi 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def _conn_request(self, conn, request_uri, method, body, headers):
        for i in range(2):
            try:
                conn.request(method, request_uri, body, headers)
                response = conn.getresponse()
            except socket.gaierror:
                conn.close()
                raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
            except httplib.HTTPException, e:
                if i == 0:
                    conn.close()
                    conn.connect()
                    continue
                else:
                    raise
            else:
                content = response.read()
                response = Response(response)
                if method != "HEAD":
                    content = _decompressContent(response, content)

            break;
        return (response, content)
AuroraAPI.py 文件源码 项目:aurora-sdk-win 作者: nanoleaf 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def send(verb, endpoint, body):
    __API_LISTENER = __IP_ADDR + ":" + __PORT
    iprint("sending to: " + __API_LISTENER)
    try:
        conn = httplib.HTTPConnection(__API_LISTENER)
        if len(body) != 0:
            conn.request(
                verb,
                endpoint,
                body,
                {"Content-Type": "application/json"}
            )
        else :
            conn.request(verb, endpoint)

        response = conn.getresponse()
        body = response.read()
        return response.status, response.reason, body
    except (httplib.HTTPException, socket.error) as ex:
        print ("Error: %s" % ex)
        quit()
fetcher_virustotalapi.py 文件源码 项目:costi 作者: lawlrenz 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def get_infos(params, adr):
    data = urllib.urlencode(params)
    req = urllib2.Request(adr, data)
    try:
        response = urllib2.urlopen(req)
    except urllib2.HTTPError, e:
        print e
        return False
    except urllib2.URLError, e:
        print e
        return False
    except httplib.HTTPException, e:
        print e
        return False

    read_resp = response.read()
    if len(read_resp) > 0:
        return json.loads(read_resp)
    else:
        return False
__init__.py 文件源码 项目:xxNet 作者: drzorm 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = str(response.status_code)
        self.response['reason'] = httplib.responses.get(response.status_code, 'Ok')
        self.response.status = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
__init__.py 文件源码 项目:autosub-bootstrapbill 作者: BenjV 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def _conn_request(self, conn, request_uri, method, body, headers):
        for i in range(2):
            try:
                conn.request(method, request_uri, body, headers)
            except socket.gaierror:
                conn.close()
                raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
            except socket.error, e:
                if not hasattr(e, 'errno'): # I don't know what this is so lets raise it if it happens
                    raise
                elif e.errno == errno.ECONNREFUSED: # Connection refused
                    raise
                # Just because the server closed the connection doesn't apparently mean
                # that the server didn't send a response.
                pass
            except httplib.HTTPException:
                # Just because the server closed the connection doesn't apparently mean
                # that the server didn't send a response.
                pass
            try:
                response = conn.getresponse()
            except (socket.error, httplib.HTTPException):
                if i == 0:
                    conn.close()
                    conn.connect()
                    continue
                else:
                    raise
            else:
                content = ""
                if method == "HEAD":
                    response.close()
                else:
                    content = response.read()
                response = Response(response)
                if method != "HEAD":
                    content = _decompressContent(response, content)
            break
        return (response, content)
__init__.py 文件源码 项目:Deploy_XXNET_Server 作者: jzp820927 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = str(response.status_code)
        self.response['reason'] = httplib.responses.get(response.status_code, 'Ok')
        self.response.status = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
px_httpc.py 文件源码 项目:perimeterx-python-wsgi 作者: PerimeterX 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def send(uri, body, config):
    logger = config['logger']
    headers = {
        'Authorization': 'Bearer ' + config.get('auth_token', ''),
        'Content-Type': 'application/json'
    }
    try:
        start = time.time()
        http_client.request('POST', uri, body=json.dumps(body), headers=headers)
        r = http_client.getresponse()

        if r.status != 200:
            logger.error('error posting server to server call ' + r.reason)
            return False

        logger.debug('Server call took ' + str(time.time() - start) + 'ms')
        response_body = r.read()

        return json.loads(response_body)
    except httplib.HTTPException:
        init(config)
        return False
app.py 文件源码 项目:fulfillment-webhook-translate-python 作者: dialogflow 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def translate_text(query, source_lang_code, target_lang_code):
    """returns translated text or text indicating a translation/network error

    Takes a text to be translated, source language and target language code
    2 letter ISO code found in language_list.py
    """

    try:
        translations = TRANSLATION_SERVICE.translations().list(
            source=source_lang_code,
            target=target_lang_code,
            q=query
        ).execute()
        translation = translations['translations'][0]
        if 'detectedSourceLanguage' in translation.keys():
            source_lang_code = translation['detectedSourceLanguage']
        resp = random.choice(_TRANSLATE_RESULT).format(
            text=translation['translatedText'],
            fromLang=language_code_dict[source_lang_code],
            toLang=language_code_dict[target_lang_code])
    except (HTTPError, URLError, HTTPException):
        resp = random.choice(_TRANSLATE_NETWORK_ERROR)
    except Exception:
        resp = random.choice(_TRANSLATE_ERROR)
    return resp
driver.py 文件源码 项目:felix 作者: axbaretto 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def _start_snapshot_request(self):
        """
        Issues the HTTP request to etcd to load the snapshot but only
        loads it as far as the headers.
        :return: tuple of response and snapshot's etcd index.
        :raises HTTPException
        :raises HTTPError
        :raises socket.error
        :raises DriverShutdown if the etcd cluster ID changes.
        """
        _log.info("Loading snapshot headers...")
        resp = self._etcd_request(self._resync_http_pool,
                                  VERSION_DIR,
                                  recursive=True,
                                  timeout=120,
                                  preload_content=False)
        snapshot_index = int(resp.getheader("x-etcd-index", 1))
        if not self._cluster_id:
            _log.error("Snapshot response did not contain cluster ID, "
                       "resyncing to avoid inconsistency")
            raise ResyncRequired()
        _log.info("Got snapshot headers, snapshot index is %s; starting "
                  "watcher...", snapshot_index)
        return resp, snapshot_index
__init__.py 文件源码 项目:Docker-XX-Net 作者: kuanghy 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = str(response.status_code)
        self.response['reason'] = httplib.responses.get(response.status_code, 'Ok')
        self.response.status = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
AuroraAPI.py 文件源码 项目:aurora-sdk-mac 作者: nanoleaf 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def send(verb, endpoint, body):
    __API_LISTENER = __IP_ADDR + ":" + __PORT
    iprint("sending to: " + __API_LISTENER)
    try:
        conn = httplib.HTTPConnection(__API_LISTENER)
        if len(body) != 0:
            conn.request(
                verb,
                endpoint,
                body,
                {"Content-Type": "application/json"}
            )
        else :
            conn.request(verb, endpoint)

        response = conn.getresponse()
        body = response.read()
        return response.status, response.reason, body
    except (httplib.HTTPException, socket.error) as ex:
        print ("Error: %s" % ex)
        quit()
test_glance.py 文件源码 项目:os-xenapi 作者: openstack 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def test_download_failed_HTTPException(self, mock_urlopen):
        mock_urlopen.side_effect = httplib.HTTPException()
        fake_request = urllib2.Request('http://fakeurl.com')

        self.assertRaises(
            self.glance.RetryableError,
            self.glance._download_tarball_and_verify,
            fake_request, 'fake_staging_path')
scan.py 文件源码 项目:headers 作者: oshp 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def connection(self, url, scheme=HTTPS_SCHEME):
        site = scheme + '://' + url
        req = urllib2.Request(site)
        req.add_header('User-Agent', self.settings['http']['user_agent'])
        req.add_header('Origin', self.settings['http']['origin'])
        try:
            response = urllib2.urlopen(req, timeout=3)
        except socket.error as error:
            return str(error), -1, ''
        except urllib2.URLError as error:
            return str(error.reason), -2, ''
        except httplib.HTTPException as error:
            return str(error), -3, ''
        else:
            return response.geturl(), response.getcode(), response.info().items()
suneo-bot.py 文件源码 项目:Shodita 作者: Quantika14 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def detect_wp(html, dominio):
    soup = BeautifulSoup(html, "html.parser")
    try:    
        #Buscamos generator
        gen = soup.findAll(attrs={"name":"generator"})
        if "Wordpress" in str(gen):
            return True
        else: #Buscamos wp-content en el html
            if html.find("wp-content")>0:
                return True
            else:#Buscamos links con xmlrpc.php
                links = soup.findAll("link")
                for l in links:
                    if "xmlrpc.php" in str(l):
                        return True
                    else:#Buscamos el readme.html
                        try:
                            url = "http://" + dominio + "/readme.html"
                            html = urllib.urlopen(url).read()
                            soup = BeautifulSoup(html)
                            for h1 in soup.find_all('h1', {'id':"logo"}):
                                h1 = remove_tags(str(h1)) #PARSER
                                if h1:
                                    return True
                        except urllib2.HTTPError, e:
                            continue 
                        except urllib2.URLError, e:
                            continue
                        except httplib.HTTPException, e:
                            continue
    except:
        return False
__init__.py 文件源码 项目:office-interoperability-tools 作者: milossramek 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def request(self, method, url, body, headers):
      # Calculate the absolute URI, which fetch requires
      netloc = self.host
      if self.port:
        netloc = '%s:%s' % (self.host, self.port)
      absolute_uri = '%s://%s%s' % (self.scheme, netloc, url)
      try:
        try: # 'body' can be a stream.
          body = body.read()
        except AttributeError:
          pass
        response = fetch(absolute_uri, payload=body, method=method,
            headers=headers, allow_truncated=False, follow_redirects=False,
            deadline=self.timeout,
            validate_certificate=self.validate_certificate)
        self.response = ResponseDict(response.headers)
        self.response['status'] = str(response.status_code)
        self.response['reason'] = httplib.responses.get(response.status_code, 'Ok')
        self.response.status = response.status_code
        setattr(self.response, 'read', lambda : response.content)

      # Make sure the exceptions raised match the exceptions expected.
      except InvalidURLError:
        raise socket.gaierror('')
      except (DownloadError, ResponseTooLargeError, SSLCertificateError):
        raise httplib.HTTPException()
__init__.py 文件源码 项目:office-interoperability-tools 作者: milossramek 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def getresponse(self):
      if self.response:
        return self.response
      else:
        raise httplib.HTTPException()
lighttpd_server.py 文件源码 项目:nojs 作者: chrisdickinson 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def _TestServerConnection(self):
    # Wait for server to start
    server_msg = ''
    for timeout in xrange(1, 5):
      client_error = None
      try:
        with contextlib.closing(httplib.HTTPConnection(
            '127.0.0.1', self.port, timeout=timeout)) as http:
          http.set_debuglevel(timeout > 3)
          http.request('HEAD', '/')
          r = http.getresponse()
          r.read()
          if (r.status == 200 and r.reason == 'OK' and
              r.getheader('Server') == self.server_tag):
            return (None, server_msg)
          client_error = ('Bad response: %s %s version %s\n  ' %
                          (r.status, r.reason, r.version) +
                          '\n  '.join([': '.join(h) for h in r.getheaders()]))
      except (httplib.HTTPException, socket.error) as client_error:
        pass  # Probably too quick connecting: try again
      # Check for server startup error messages
      ix = self.process.expect([pexpect.TIMEOUT, pexpect.EOF, '.+'],
                               timeout=timeout)
      if ix == 2:  # stdout spew from the server
        server_msg += self.process.match.group(0) # pylint: disable=no-member
      elif ix == 1:  # EOF -- server has quit so giveup.
        client_error = client_error or 'Server exited'
        break
    return (client_error or 'Timeout', server_msg)
dotnetpad.py 文件源码 项目:Taigabot 作者: FrozenPigs 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def dotnetpad(lang, code, timeout=30):
    "Posts a provided snippet of code in a provided langugage to dotnetpad.net"

    code = code.encode('utf8')
    params = urllib.urlencode({'language': lang, 'code': code})

    headers = {"Content-type": "application/x-www-form-urlencoded",
               "Accept": "text/plain"}

    try:
        conn = httplib.HTTPConnection("dotnetpad.net", 80, timeout=timeout)
        conn.request("POST", "/Skybot", params, headers)
        response = conn.getresponse()
    except httplib.HTTPException:
        conn.close()
        return 'error: dotnetpad is broken somehow'
    except socket.error:
        return 'error: unable to connect to dotnetpad'

    try:
        result = json.loads(response.read())
    except ValueError:
        conn.close()
        return 'error: dotnetpad is broken somehow'

    conn.close()

    if result['Errors']:
        return 'First error: %s' % (result['Errors'][0]['ErrorText'])
    elif result['Output']:
        return result['Output'].lstrip()
    else:
        return 'No output'
__init__.py 文件源码 项目:Taigabot 作者: FrozenPigs 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def getresponse(self):
      if self.response:
        return self.response
      else:
        raise httplib.HTTPException()
__init__.py 文件源码 项目:Intranet-Penetration 作者: yuxiaokui 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def getresponse(self):
      if self.response:
        return self.response
      else:
        raise httplib.HTTPException()
__init__.py 文件源码 项目:MKFQ 作者: maojingios 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def getresponse(self):
      if self.response:
        return self.response
      else:
        raise httplib.HTTPException()


问题


面经


文章

微信
公众号

扫码关注公众号