コード例 #1
0
def __get_user_list():
    return list2dict([{"id": 1, "code": "hoge1", "name": "ほげ 1", "nameReading": "",
                       "email": "*****@*****.**", "url": "", "phone": ""},
                      {"id": 2, "code": "hoge2", "name": "ほげ 2", "nameReading": "",
                       "email": "*****@*****.**", "url": "", "phone": ""},
                      {"id": 3, "code": "hoge3", "name": "ほげ 3", "nameReading": "",
                       "email": "*****@*****.**", "url": "", "phone": ""},
                      ])
コード例 #2
0
            except ValueError, e:
                print e
            except BadStatusLine, e:
                print e
            except SocketError, e:
                print e
            else:
                if resp.url != url:
                    REDIRECT.append(url)
                try:
                    data = resp.read()
                except Exception, e:
                    print e
                else:
                    resp_headers = resp.headers.headers
                    resp_headers_dict = list2dict(resp_headers)
                    response = HttpResponse(code=str(resp.code),
                                            reason=resp.msg,
                                            headers=resp_headers_dict,
                                            data=data)
                    return (request, response)

    def run(self):
        import gevent
        from gevent import monkey
        monkey.patch_all()
        from gevent import pool
        # default 200
        # g_pool = pool.Pool(200)
        g_pool = pool.Pool(self.coroutine)
        tasks = [g_pool.spawn(self.gen_traffic, url) for url in self.url_list]
コード例 #3
0
def __get_user_list(login_info: dict, token: str):
    url = "{0}/v1/base/user/list".format(cybozu_url)
    return list2dict(__common_request(login_info, token, url))