eLvErDe / yiimp-blocks-found-to-discord

Poll a Yiim pool block found result page and post a message to Discord chat room
BSD 3-Clause "New" or "Revised" License
1 stars 17 forks source link

async with aiohttp.ClientSession() as session: #2

Open goodthebest opened 6 years ago

goodthebest commented 6 years ago

@eLvErDe Adam I tried your script and end up getting this error, below is debug

image

any idea?

eLvErDe commented 6 years ago

Hello, can you confirm the aiohttp version your are running ? That looks like being related

mtompkins commented 6 years ago

Hi @eLvErDe - confirming the above

Apr  9 13:22:05 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:     async with aiohttp.ClientSession() as session:
Apr  9 13:22:05 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: AttributeError: __aexit__
Apr  9 13:22:10 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [asyncio                  ] Unclosed client session
Apr  9 13:22:10 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: client_session: <aiohttp.client.ClientSession object at 0x7f1b245d5ef0>
Apr  9 13:22:10 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [poll_yiimp_events        ] Exception occurred: AttributeError: __aexit__
Apr  9 13:22:10 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: Traceback (most recent call last):
Apr  9 13:22:10 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 109, in poll_yiimp_events
Apr  9 13:22:10 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:     async with aiohttp.ClientSession() as session:
Apr  9 13:22:10 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: AttributeError: __aexit__
Apr  9 13:22:15 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [asyncio                  ] Unclosed client session
Apr  9 13:22:15 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: client_session: <aiohttp.client.ClientSession object at 0x7f1b245d5eb8>
Apr  9 13:22:15 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [poll_yiimp_events        ] Exception occurred: AttributeError: __aexit__
Apr  9 13:22:15 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: Traceback (most recent call last):
Apr  9 13:22:15 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 109, in poll_yiimp_events
Apr  9 13:22:15 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:     async with aiohttp.ClientSession() as session:
Apr  9 13:22:15 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: AttributeError: __aexit__
Apr  9 13:22:20 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [asyncio                  ] Unclosed client session
Apr  9 13:22:20 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: client_session: <aiohttp.client.ClientSession object at 0x7f1b245d5ef0>
Apr  9 13:22:20 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [poll_yiimp_events        ] Exception occurred: AttributeError: __aexit__
Apr  9 13:22:20 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: Traceback (most recent call last):
Apr  9 13:22:20 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 109, in poll_yiimp_events
Apr  9 13:22:20 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:     async with aiohttp.ClientSession() as session:
Apr  9 13:22:20 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: AttributeError: __aexit__
Apr  9 13:22:25 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [asyncio                  ] Unclosed client session
Apr  9 13:22:25 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: client_session: <aiohttp.client.ClientSession object at 0x7f1b245d5eb8>
Apr  9 13:22:25 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: ERROR    [poll_yiimp_events        ] Exception occurred: AttributeError: __aexit__
Apr  9 13:22:25 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: Traceback (most recent call last):
Apr  9 13:22:25 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 109, in poll_yiimp_events
Apr  9 13:22:25 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]:     async with aiohttp.ClientSession() as session:
Apr  9 13:22:25 queenbee-hive-1 yiimp-blocks-found-to-discord[9579]: AttributeError: __aexit__

python3-bs4 is already the newest version (4.4.1-1).
python3-aiohttp is already the newest version (0.20.2-1)
eLvErDe commented 6 years ago

Okay well that's clearly related to the aiohttp version. I'll have a look to make it compatible with older version. I guess the async context manager does not exist yet but that should be easy to fix

mtompkins commented 6 years ago

Great - thanks for sharing your project. I'm not a python guy - otherwise I'd have just offered a pull request. Good luck :)

mtompkins commented 6 years ago

I can confirm my workaround - Changed the systemd script from nobody to my pool user account Removed and installed aiohttp with pip3 --user Current version indeed removes the error.

eLvErDe commented 6 years ago

Hi,

Can you try this version ? Sadly I don't think there's an easy way to support both version at the same, but this one should be compatible with aiohtp before they moved to async with.

https://github.com/eLvErDe/yiimp-blocks-found-to-discord/tree/old-aiohttp-compat

Also @mtompkins changing the user is probably not a wise move, I'd stick to nobody

mtompkins commented 6 years ago

Results of change:

Apr 10 07:03:52 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: Traceback (most recent call last):
Apr 10 07:03:52 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 134, in poll_yiimp_events
Apr 10 07:03:52 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:     raise e
Apr 10 07:03:52 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 130, in poll_yiimp_events
Apr 10 07:03:52 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:     resp.raise_for_status()
Apr 10 07:03:52 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: AttributeError: 'ClientResponse' object has no attribute 'raise_for_status'
Apr 10 07:03:57 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: ERROR    [poll_yiimp_events        ] Exception occurred: AttributeError: 'ClientResponse' object has no attribute 'raise_for_status'
Apr 10 07:03:57 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: Traceback (most recent call last):
Apr 10 07:03:57 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 134, in poll_yiimp_events
Apr 10 07:03:57 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:     raise e
Apr 10 07:03:57 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 130, in poll_yiimp_events
Apr 10 07:03:57 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:     resp.raise_for_status()
Apr 10 07:03:57 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: AttributeError: 'ClientResponse' object has no attribute 'raise_for_status'
Apr 10 07:04:02 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: ERROR    [poll_yiimp_events        ] Exception occurred: AttributeError: 'ClientResponse' object has no attribute 'raise_for_status'
Apr 10 07:04:02 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: Traceback (most recent call last):
Apr 10 07:04:02 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 134, in poll_yiimp_events
Apr 10 07:04:02 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:     raise e
Apr 10 07:04:02 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 130, in poll_yiimp_events
Apr 10 07:04:02 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]:     resp.raise_for_status()
Apr 10 07:04:02 queenbee-hive-1 yiimp-blocks-found-to-discord[13236]: AttributeError: 'ClientResponse' object has no attribute 'raise_for_status'
eLvErDe commented 6 years ago

Hi again,

I just pushed another legacy fix, could you try again ?

Adam.

mtompkins commented 6 years ago
Apr 10 13:07:34 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: INFO     [main                     ] Starting refresh_stock_exchange_markets
Apr 10 13:07:34 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: INFO     [main                     ] Starting refresh_cryptopia_markets
Apr 10 13:07:34 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: INFO     [main                     ] Starting poll_yiimp_events coroutine
Apr 10 13:07:34 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: INFO     [main                     ] Starting post_events_discord coroutine
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: ERROR    [refresh_cryptopia_markets] Exception occurred: ServerDisconnectedError:
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: Traceback (most recent call last):
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 92, in refresh_cryptopia_markets
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     await resp.release()
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/client_reqrep.py", line 658, in release
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     chunk = yield from content.readany()
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/streams.py", line 472, in wrapper
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     result = yield from func(self, *args, **kw)
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/streams.py", line 535, in readany
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     return (yield from super().readany())
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/streams.py", line 270, in readany
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     yield from self._waiter
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     yield self  # This tells Task to wait for completion.
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     future.result()
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     raise self._exception
Apr 10 13:07:35 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: aiohttp.errors.ServerDisconnectedError
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: ERROR    [refresh_st_exc_markets   ] Exception occurred: ServerDisconnectedError:
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: Traceback (most recent call last):
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 57, in refresh_stocks_exchange_markets
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     await resp.release()
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/client_reqrep.py", line 658, in release
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     chunk = yield from content.readany()
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/streams.py", line 472, in wrapper
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     result = yield from func(self, *args, **kw)
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/streams.py", line 535, in readany
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     return (yield from super().readany())
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3/dist-packages/aiohttp/streams.py", line 270, in readany
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     yield from self._waiter
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     yield self  # This tells Task to wait for completion.
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     future.result()
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:   File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]:     raise self._exception
Apr 10 13:07:36 queenbee-hive-1 yiimp-blocks-found-to-discord[27507]: aiohttp.errors.ServerDisconnectedError

There was more but figured that was enough. Also, just mentioning that when I tried my workaround, although the daemon started it did not detect new blocks from the pool (or at least didn't announce them through the webhook)

eLvErDe commented 6 years ago

Can you try again ?

mtompkins commented 6 years ago
Apr 10 13:28:47 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: INFO     [main                     ] Starting refresh_stock_exchange_markets
Apr 10 13:28:47 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: INFO     [main                     ] Starting refresh_cryptopia_markets
Apr 10 13:28:47 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: INFO     [main                     ] Starting poll_yiimp_events coroutine
Apr 10 13:28:47 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: INFO     [main                     ] Starting post_events_discord coroutine
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: ERROR    [refresh_cryptopia_markets] Exception occurred: AttributeError: 'ClientResponse' object has no attribute 'status_code'
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: Traceback (most recent call last):
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 88, in refresh_cryptopia_markets
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:     raise e
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 84, in refresh_cryptopia_markets
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:     assert resp.status_code == 200, 'aiohttp call to %s failed' % url
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: AttributeError: 'ClientResponse' object has no attribute 'status_code'
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: ERROR    [refresh_st_exc_markets   ] Exception occurred: AttributeError: 'ClientResponse' object has no attribute 'status_code'
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: Traceback (most recent call last):
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 55, in refresh_stocks_exchange_markets
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:     raise e
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 51, in refresh_stocks_exchange_markets
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:     assert resp.status_code == 200, 'aiohttp call to %s failed' % url
Apr 10 13:28:48 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: AttributeError: 'ClientResponse' object has no attribute 'status_code'
Apr 10 13:28:53 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: ERROR    [poll_yiimp_events        ] Exception occurred: AttributeError: 'ClientResponse' object has no attribute 'status_code'
Apr 10 13:28:53 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: Traceback (most recent call last):
Apr 10 13:28:53 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 130, in poll_yiimp_events
Apr 10 13:28:53 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:     raise e
Apr 10 13:28:53 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:   File "/usr/local/bin/yiimp-blocks-found-to-discord.py", line 126, in poll_yiimp_events
Apr 10 13:28:53 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]:     assert resp.status_code == 200, 'aiohttp call to %s failed' % url
Apr 10 13:28:53 queenbee-hive-1 yiimp-blocks-found-to-discord[32085]: AttributeError: 'ClientResponse' object has no attribute 'status_code'
eLvErDe commented 6 years ago

Again ? :D

mtompkins commented 6 years ago

No error on start - will advise if it announced a found block

eLvErDe commented 6 years ago

Can you try again with the modification I just made ? I have the feeling I do need to drain release method if not using aiohttp as an async context manager. The version you're running may leak http connections....

mtompkins commented 6 years ago

No errors on update. Will advise.

mtompkins commented 6 years ago

So as I mentioned before, unfortunately, it is not announcing any blocks on Discord. There is no error or other information within the journal. I think at this point I'm going to have a look at some other approaches but thanks for your efforts.

eLvErDe commented 6 years ago

Well there's probably a parsing issue, maybe a different YIIMP version. Could you give me a link to your pool so I can try myself ?

mtompkins commented 6 years ago

The problem isn't your scraping, the problem is with the way yiimp currently uses memcache. Your scraper winds up scraping the correct URL, however, there isn't always current data painted there. That page doesn't give an "all algos" rendering by default. I can't think of any way around this. You can experience this on yiimp.eu

eLvErDe commented 6 years ago
INFO     [parse_events             ] New event found while parsing: 3.126000 BTX found at 2018-04-11 22:24:33
INFO     [parse_events             ] New event found while parsing: 3.125000 BTX found at 2018-04-11 22:27:08
INFO     [parse_events             ] New event found while parsing: 3.126000 BTX found at 2018-04-11 22:54:29
INFO     [parse_events             ] New event found while parsing: 3.127000 BTX found at 2018-04-11 23:46:17

It's definetely working on yiimp.eu!

mtompkins commented 6 years ago

You fail to understand what I explained. It's picking up a single algo, not all algos on the pool. In fact, your above shows it's only picking up BTX - a single algo on a very large pool.

eLvErDe commented 6 years ago

Oh well that's definetely a bug in YIIMP then, it does not occurs on the small pool for which I wrote this project.

Clearly the URL looks like being "coins-wide": http://yiimp.eu/site/found_results

mtompkins commented 6 years ago

Absolutely correct, it isn't a shortcoming of your approach. It's the randomness of what's in yiimps memcache at any current moment.

eLvErDe commented 6 years ago

Actually it's not. Let me explain what I see.

Switch back to the main pool page and click a different algo, go back to found_results then... See ?

The problem is that it seems to be related to a cookie PHPSESSID so I'm not sure at all how to fake that. Are you running a pool youself ? I'm not a big PHP fan but that could be helpfull if someone looks the code behind this found_results routes. I'm pretty sure there's an easy way to ask for a specific algo.

mtompkins commented 6 years ago

I didn't drill down the PHP road to see where the true origination of the dynamic is as it was evident it resides somewhere between the manual click on the interface and the datastore (memcache) which is latter retrieve by PHP on the results_page.php as it renders. It was enough for me to know it "wasn't you" and I wanted to share. It explains why I wasn't getting the webhook even though your script was scraping properly.

eLvErDe commented 6 years ago

Thanks to the asyncness of this script it would be pretty easy to add a coroutine checking for the available algo and then agregate n calls to found_results for each algo. But I need to figure out how to call this url with provided algorithm...

eLvErDe commented 6 years ago

Crap, it's actually really related to some user session/cookie. Oh, god... https://github.com/tpruvot/yiimp/blob/next/web/yaamp/modules/site/results/found_results.php

Still I should be able to generate a session myself by simulating a first click on the target algo. It's too late here, europe time but I may try something soon if you're interrested in.

mtompkins commented 6 years ago

When you get to the point of wanting to test, I'm happy to oblige.

mtompkins commented 6 years ago

You know, the easy way to do this is probably a 2nd page, adding the route and replacing $algo = user()->getState('yaamp-algo'); with an all choice.

goodthebest commented 6 years ago

this can be accomplished if script gets nod from e.g, `blocknotify=/var/stratum/blocknotify example.com:3737 561 %s

eLvErDe commented 6 years ago

Pretty sure it could be as easy as doing both sequential calls in the same context manager, aiohttp is probably smart enough to handle that.

But yeah it would be easier to fix shitty YIIMP code but I'm not sure if that the way to go.

eLvErDe commented 6 years ago

@mtompkins

I'd go for something that can be PR to the upstream YIIMP repo. My first call would be a query param to be used like found_results?algo=* or found_results?algo=x16r,x16s

eLvErDe commented 6 years ago

Is there someone willing to implement this ? Otherwise I'll do

mtompkins commented 6 years ago

It isn't something I'd be able to do in the near term. I don't mind doing it but it wouldn't be soon.

eLvErDe commented 6 years ago

The biggest problem is that I am not running yiimp myself and despite I think it's no more than five lines of code I m pretty sure I won't be able to make it at first try, thanks to my php skills. That would be different in Python :D

eLvErDe commented 6 years ago

At least can someone test a modified version of this file if I do it ?

mtompkins commented 6 years ago

I should be able to - I'm not a php guy either but I should be able to run a test in a VM without issue

eLvErDe commented 6 years ago

Will try to add this feature tomorrow evening (starting like 5h from now) if you are available for testing that should be quick

mtompkins commented 6 years ago

Sure, just ping this thread. Have a nice night.

eLvErDe commented 6 years ago

Hi,

Can you try this ? https://github.com/eLvErDe/yiimp/commit/5e1a48f01e2a5f2c947adf4853f05f25ac5e8c6d

It should keep working as before but you can add ?algo=all to the URL to this all blocks found or ?algo=algo1,algo2 to get specific ones

mtompkins commented 6 years ago

Undefined variable: algo ...when passing no parameter

eLvErDe commented 6 years ago

Do you have a line number ?

mtompkins commented 6 years ago

No php won't provide debugging unless you set it up. That was captured in chrome.

mtompkins commented 6 years ago

It makes sense tho - there's no cookie established as there is no previous click (conceptually). Probably have to do a null check and set to all if nothing is there.

eLvErDe commented 6 years ago

Well no it does not make any sense, everything is properly tested before being use. PHP is such a shit language :/

Are you sure it says $algo ? If so it's coming from the provided getparm function but if you look below in the file it's being use exactly the way I do...

mtompkins commented 6 years ago

screenshot from 2018-04-12 14-58-10

eLvErDe commented 6 years ago

Wtf, right below my modification:

$count = getparam('count');
$count = $count? $count: 50;

Are you sure you have applied the whole modification ? Especially the second part within the SQL request builder ?

mtompkins commented 6 years ago

Copied the full page raw

eLvErDe commented 6 years ago

https://github.com/eLvErDe/yiimp/commit/4f82d43fe45fec4d36ffcfaa16a47fa1d9566c55

eLvErDe commented 6 years ago

Forget this one, broken

mtompkins commented 6 years ago

Same