diff --git a/scrython/catalog/catalogs_object.py b/scrython/catalog/catalogs_object.py index 9b5cda8..7ac1094 100644 --- a/scrython/catalog/catalogs_object.py +++ b/scrython/catalog/catalogs_object.py @@ -1,6 +1,7 @@ import asyncio import aiohttp import urllib.parse +from threading import Thread class CatalogsObject(object): """ @@ -33,8 +34,13 @@ class CatalogsObject(object): async with aiohttp.ClientSession(loop=loop) as client: self.scryfallJson = await getRequest(client, self._url) - loop = asyncio.get_event_loop() - loop.run_until_complete(main(loop)) + def do_everything(): + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + loop.run_until_complete(main(loop)) + + t = Thread(target=do_everything) + t.run() if self.scryfallJson['object'] == 'error': raise Exception(self.scryfallJson['details']) diff --git a/scrython/rulings/rulings_object.py b/scrython/rulings/rulings_object.py index 2fc0e2f..73d81d7 100644 --- a/scrython/rulings/rulings_object.py +++ b/scrython/rulings/rulings_object.py @@ -1,6 +1,7 @@ import asyncio import aiohttp import urllib.parse +from threading import Thread class RulingsObject(object): """ @@ -47,8 +48,13 @@ class RulingsObject(object): async with aiohttp.ClientSession(loop=loop) as client: self.scryfallJson = await getRequest(client, self._url) - loop = asyncio.get_event_loop() - loop.run_until_complete(main(loop)) + def do_everything(): + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + loop.run_until_complete(main(loop)) + + t = Thread(target=do_everything) + t.run() if self.scryfallJson['object'] == 'error': raise Exception(self.scryfallJson['details']) diff --git a/scrython/sets/sets_object.py b/scrython/sets/sets_object.py index 698548d..4ff0d69 100644 --- a/scrython/sets/sets_object.py +++ b/scrython/sets/sets_object.py @@ -1,6 +1,7 @@ import asyncio import aiohttp import urllib.parse +from threading import Thread class SetsObject(object): """ @@ -43,8 +44,13 @@ class SetsObject(object): async with aiohttp.ClientSession(loop=loop) as client: self.scryfallJson = await getRequest(client, self._url) - loop = asyncio.get_event_loop() - loop.run_until_complete(main(loop)) + def do_everything(): + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + loop.run_until_complete(main(loop)) + + t = Thread(target=do_everything) + t.run() if self.scryfallJson['object'] == 'error': raise Exception(self.scryfallJson['details']) diff --git a/scrython/symbology/symbology_object.py b/scrython/symbology/symbology_object.py index 0c34f9c..7e6b727 100644 --- a/scrython/symbology/symbology_object.py +++ b/scrython/symbology/symbology_object.py @@ -1,6 +1,7 @@ import asyncio import aiohttp import urllib.parse +from threading import Thread class SymbologyObject(object): """ @@ -30,8 +31,13 @@ class SymbologyObject(object): async with aiohttp.ClientSession(loop=loop) as client: self.scryfallJson = await getRequest(client, self._url) - loop = asyncio.get_event_loop() - loop.run_until_complete(main(loop)) + def do_everything(): + loop = asyncio.new_event_loop() + asyncio.set_event_loop(loop) + loop.run_until_complete(main(loop)) + + t = Thread(target=do_everything) + t.run() if self.scryfallJson['object'] == 'error': raise Exception(self.scryfallJson['details'])