Update app.py
Browse files
app.py
CHANGED
|
@@ -110,6 +110,7 @@ async def main(urls):
|
|
| 110 |
|
| 111 |
async def post(url, session, json_data, headers, timeout=120):
|
| 112 |
try:
|
|
|
|
| 113 |
async with session.request(method='post', url=url, timeout=timeout, headers=headers, json=json_data) as response:
|
| 114 |
resp = await response.read()
|
| 115 |
print("Successfully got url {} with resp of length {}.".format(url, len(resp)))
|
|
@@ -120,7 +121,7 @@ async def post(url, session, json_data, headers, timeout=120):
|
|
| 120 |
|
| 121 |
|
| 122 |
async def main_post(urls, headers, json_data, timeout=120):
|
| 123 |
-
|
| 124 |
async with aiohttp.ClientSession() as session:
|
| 125 |
ret = await asyncio.gather(*(post(url, session, json_data[i], headers[i], timeout=timeout) for i,url in enumerate(urls)))
|
| 126 |
print("Finalized all. Return is a list of len {} outputs.".format(len(ret)))
|
|
|
|
| 110 |
|
| 111 |
async def post(url, session, json_data, headers, timeout=120):
|
| 112 |
try:
|
| 113 |
+
print('main_post: ', type(url), len(url), type(headers), len(headers), type(json_data), len(json_data), json_data.keys())
|
| 114 |
async with session.request(method='post', url=url, timeout=timeout, headers=headers, json=json_data) as response:
|
| 115 |
resp = await response.read()
|
| 116 |
print("Successfully got url {} with resp of length {}.".format(url, len(resp)))
|
|
|
|
| 121 |
|
| 122 |
|
| 123 |
async def main_post(urls, headers, json_data, timeout=120):
|
| 124 |
+
|
| 125 |
async with aiohttp.ClientSession() as session:
|
| 126 |
ret = await asyncio.gather(*(post(url, session, json_data[i], headers[i], timeout=timeout) for i,url in enumerate(urls)))
|
| 127 |
print("Finalized all. Return is a list of len {} outputs.".format(len(ret)))
|