diff --git a/test_multiprocessing.py b/test_multiprocessing.py index 21ca9fa..5222a23 100644 --- a/test_multiprocessing.py +++ b/test_multiprocessing.py @@ -11,9 +11,10 @@ def fetch(session, url): with session.get(url) as response: print(response.json()['uuid']) - -@timer(1, 1) -def main(): - with Pool() as pool: - with requests.Session() as session: - pool.starmap(fetch, [(session, URL) for _ in range(100)]) +if __name__ == "__main__": + @timer(1, 1) + + def main(): + with Pool() as pool: + with requests.Session() as session: + pool.starmap(fetch, [(session, URL) for _ in range(100)])