コード例 #1
0
ファイル: app.py プロジェクト: pombredanne/minilab
 def setUpClass(cls):
     name = 'django_' + cls.concurrency
     argv = [__file__, 'pulse', '--bind', '127.0.0.1:0',
             '--concurrency', cls.concurrency]
     cls.app = yield send('arbiter', 'run', start_server, name, argv)
     cls.uri = 'http://{0}:{1}'.format(*cls.app.address)
     cls.ws = 'ws://{0}:{1}/message'.format(*cls.app.address)
     cls.http = http.HttpClient()
コード例 #2
0
 def setUpClass(cls):
     s = server(bind='127.0.0.1:0', name=cls.__name__.lower(),
                concurrency=cls.concurrency)
     cls.app_cfg = yield from send('arbiter', 'run', s)
     cls.uri = 'http://%s:%s' % cls.app_cfg.addresses[0]
     cls.ws = 'ws://%s:%s/message' % cls.app_cfg.addresses[0]
     cls.rpc = rpc.JsonProxy('%s/rpc' % cls.uri)
     cls.http = http.HttpClient()
コード例 #3
0
 def setUpClass(cls):
     name = cls.__name__.lower()
     argv = [__file__, 'pulse',
             '--bind', '127.0.0.1:0',
             '--concurrency', cls.concurrency,
             '--pulse-app-name', name,
             '-s', 'local://?name=%s' % name]
     cls.app = yield send('arbiter', 'run', start_server, name, argv)
     cls.uri = 'http://{0}:{1}'.format(*cls.app.address)
     cls.ws = 'ws://{0}:{1}/message'.format(*cls.app.address)
     cls.http = http.HttpClient()
コード例 #4
0
 async def setUpClass(cls):
     name = cls.__name__.lower()
     argv = [
         __file__, 'pulse', '-b', '127.0.0.1:0', '--concurrency',
         cls.concurrency, '--pulse-app-name', name, '--data-store',
         'pulsar://127.0.0.1:6410/1'
     ]
     cls.app_cfg = await send('arbiter', 'run', start_server, name, argv)
     addr = cls.app_cfg.addresses[0]
     cls.uri = 'http://{0}:{1}'.format(*addr)
     cls.ws = 'ws://{0}:{1}/message'.format(*addr)
     cls.http = http.HttpClient()
コード例 #5
0
ファイル: app.py プロジェクト: azazel75/pulsar
 def setUpClass(cls):
     cls.exc_id = gen_unique_id()[:8]
     name = cls.__name__.lower()
     argv = [
         __file__, 'pulse', '-b', '127.0.0.1:0', '--concurrency',
         cls.concurrency, '--exc-id', cls.exc_id, '--pulse-app-name', name,
         '--data-store', 'pulsar://127.0.0.1:6410/1'
     ]
     cls.app_cfg = yield send('arbiter', 'run', start_server, name, argv)
     assert cls.app_cfg.exc_id == cls.exc_id, "Bad execution id"
     addr = cls.app_cfg.addresses[0]
     cls.uri = 'http://{0}:{1}'.format(*addr)
     cls.ws = 'ws://{0}:{1}/message'.format(*addr)
     cls.http = http.HttpClient()
コード例 #6
0
ファイル: pusher.py プロジェクト: pvanderlinden/pulsar-cloud
 def __init__(self,
              app_id=None,
              key=None,
              secret=None,
              host=None,
              port=None,
              encoder=None,
              secure=False):
     self.key = key or ''
     self.app_id = app_id or ''
     if self.app_id and not app_id_re.match(self.app_id):
         raise NameError('Invalid app id "%s"' % self.app_id)
     self.secret = secret or ''
     self.host = host or self.host
     self.port = port or (443 if secure else 80)
     self.secure = secure
     self.encoder = encoder
     self.logger = logging.getLogger('pulsar.pusher')
     self.http = http.HttpClient(websocket_handler=self)
     self._consumer = None
     self._waiter = None
     self._channels = {}
コード例 #7
0
 async def setUpClass(cls):
     await run_test_server(cls, server)
     cls.ws = 'ws://%s:%s/message' % cls.app_cfg.addresses[0]
     cls.rpc = rpc.JsonProxy('%s/rpc' % cls.uri)
     cls.http = http.HttpClient()
コード例 #8
0
ファイル: tunnel.py プロジェクト: japaks/pulsar
def post_request(response):
    print('REQUEST DONE')
    print(response)
    print('Headers')
    print(response.headers)
    return response


hooks = {
    'data_received': data_received,
    'pre_request': pre_request,
    'post_request': post_request
}

client = http.HttpClient(proxy_info=proxy_info, force_sync=True)


def get(bit=''):
    url = HOME_URL + bit
    return client.get(url, **hooks)


print('======================================================================')
print('======================================================================')
print(get())
print('\n\n')
print('======================================================================')
print('======================================================================')
print(get('redirect/1'))
print('\n\n')
コード例 #9
0
ファイル: manage.py プロジェクト: robgil/pulsar
 def http_client(self):
     '''The :class:`.HttpClient` used by this proxy middleware for
     accessing upstream resources'''
     return http.HttpClient(decompress=False, store_cookies=False)
コード例 #10
0
 def test_json(self):
     c = http.HttpClient()
     data = yield from c.get('https://api.bitfinex.com/v1/pubticker/BTCUSD')
     self.assertTrue(data)
コード例 #11
0
ファイル: tunnel.py プロジェクト: zzzz123321/pulsar
from pulsar.apps import http
import requests     # noqa

if __name__ == '__main__':
    session = http.HttpClient()
    # session = requests.session()
    #
    url = 'https://api.github.com/'
    verify = True
    #
    url = 'https://127.0.0.1:8070'
    verify = False
    #
    proxies = {'https': 'http://127.0.0.1:8060'}
    response = session.get(url, proxies=proxies, verify=verify)
    print(response)
    # proxies = {'https': 'http://127.0.0.1:8080'}
    # response = session.get(url, proxies=proxies, verify=verify)
    # print(response)
    proxies = {'https': 'http://127.0.0.1:8060'}
    response = session.get(url, proxies=proxies, verify=verify)
    print(response)
コード例 #12
0
 def http_client(self):
     '''The :ref:`HttpClient <'''
     return http.HttpClient(decompress=False, store_cookies=False)