Open alfonsrv opened 3 years ago
😕 Zulip (Or slack/telegram) setup guide
😕 Doing everything as described but cmd throws "Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases.".
Since I am a beginner every try to fix it was unsuccessful. Tried adding Path to Environment Variables and switching off App Execution Aliases.
No you didn't 😛 You have a couple of options:
python.exe
and python3.exe
in %LocalAppData%\Microsoft\WindowsApps
%LocalAppData%\Microsoft\WindowsApps
from the Environment variables as higher up in the hierarchy than the one you added manually. 429 all the time. With or without concurrent, i INSTANTLY get 429.
Is this even working for more than 1 Location?
@AmansRevenger yup – works just fine. This issue is not the place for your frustration. Would appreciate it if you created a new issue instead if you feel like you're not the only one experiencing this.
You cannot do anything against 429
except wait and not avoid running in Docker environments.
I may be to unskilled to use a bot. I followed your instructions and got this message on my mac:
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip. Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue. To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Usage:
pip3 install [options]
no such option: --iser
Traceback (most recent call last):
File "main.py", line 10, in
Any help appreciated...
@boeing747430 can you try running python3 -m pip install -r requirements.txt --user
and see if that fixes it for you?
Now it opens chrome on the impfterminservice.de website, but there it opens with the Bundesland selection. Will it still give me alerts without me selecting anything there? Also, I am not sure waht to do exactly in order to test the alerts.
Sorry, but I appreciate your help very much.🙂
@boeing747430 don't worry. :) It should choose a Bundesland and keep on navigating by itself. If it didn't choose one, you likely have a BUNDESLAND
set in settings.py
that is not listed. Can you check? Watch out for spaces in the string.
You can test your alerts using python3 main.py --alerts
– as specified in the README.md on the main page.
Seems to work now - thanks so much.
You cannot do anything against 429 except wait and not avoid running in Docker environments.
What exactly do you mean ? "not avoid" ... is using docker not recommened? If yes, why?
@AmansRevenger as mentioned in DOCKER.md things might break when using concurrency. I'm not sure why, but I also only keep on getting 429
errors in Docker environments until I have successfully authenticated with a Vermittlungscode manually (works for some reason). After that it can monitor for new appointments flawlessly, but it seems like everything else doesn't work in Docker environments.
A variety of things might be wrong here – e.g. we have to use --no-sandbox
switch to get Chrome to start in the first place. I haven't investigated as Docker only benefits a very small margin of people and as it's likely an abuse-factor anyways. Happy about pull requests though, if you have time to debug it.
Any tips ? I have tried setting the SELENIUM_PATH as well, but as you can see, I can run it as is from a CMD ...
EDIT: nvm, fixed it by deleting the settings.SELENIUM_PATH argument in impf/browser.py , line 38.
must have messed up the var somehow. Or the example settings is weird / non empty idk. Thanks anyway ;)
@AmansRevenger top – lemme know if you encounter any issues
Brilliant bot, switched from my self developed (noob level) Selenium script to your bot. 2 topics that might be useful to add:
In the meantime, I booked an appointment with my self developed script, but I will recommend yours to all colleagues and friends 👍🏽
Hey @ChrizZz90, thanks for the feedback – always much appreciated!
Do you think you could integrate your Telegram receive function in this project? Would be great! I think the last message should be enough, or maybe if it's filterable just the messages of the last 120s as I'm doing it with the Zulip messages. Just make a Pull request if you are so inclined. :)
Alfons
#Receive Chatupdates update_url = 'https://api.telegram.org/bot' + bot_token + '/getUpdates?chat_id=' + bot_chatID chat_update = requests.get(update_url) chat_json = json.loads(chat_update.text) last = len(chat_json['result']) last = last - 1 pin = chat_json['result'][last]['message']['text'] pin_input = driver.find_element_by_xpath("//input[@formcontrolname='pin']") pin_input.send_keys(pin)
I think only adding it wouldn't work. This is my script for adding the SMS Pin. But you need to know to write only the PIN. Maybe working with a one time code would work? Or just if Telegram enabled select the first appointment and book it automated.
Alright. Wanted to avoid downloading this app; but added full Telegram support 👍
Your code snippet was very helpful, thanks!
Hi, very useful app. A couple of feature requests:
Hey @starykov thanks for your feature requests. While I understand how such a setting could seem beneficial first glance, it will actually likely result in more shadow bans, which is why I left it out. The settings.sample.py
is pre-configured of what I believe is a best-practice configuration for most people. If you feel otherwise you could e.g. start an Issue discussing such configuration.
Hi,
thanks for your work.
Regarding Telegram support: you should add a
if not _message is None:
in alert.py line 115; not all telegram results contain a message
@Maik7 thanks for the pointer. Don't really use Telegram as mentioned – only happens when you didn't text your bot before I assume?
Hi Alfons, it happened if I added and removed the bot from a group. Regards, MaikAm 25.05.21, 08:11, alfonsrv @.***> schrieb:
@Maik7 thanks for the pointer. Don't really use Telegram as mentioned – only happens when you didn't text your bot before I assume?
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.
[
{
@.***": "http://schema.org",
@.***": "EmailMessage",
"potentialAction": {
@.***": "ViewAction",
"target": "https://github.com/alfonsrv/impf-botpy/issues/1#issuecomment-847568553",
"url": "https://github.com/alfonsrv/impf-botpy/issues/1#issuecomment-847568553",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
@.***": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]
@alfonsrv I had the situation tonight that the bot found available appointments but without my feedback, it exited. Is it possible to book the appointment in any case or a fallback if feedback is missing? Maybe as a settings configuration? (Maybe something like this is already implemented. In my case, my script booked the slot during the waiting time of the bot).
Seems like that also during the night (and in the potential sleep period) appointments are available.
Also, I want to share my delete cache code. I don't know if it helps, but it might be usable.
def delete_cache():
driver.execute_script("window.open('');")
sleep(2)
driver.switch_to.window(driver.window_handles[-1])
sleep(2)
driver.get('chrome://settings/clearBrowserData') # for old chromedriver versions use cleardriverData
sleep(2)
actions = ActionChains(driver)
actions.send_keys(Keys.TAB * 3 + Keys.DOWN * 3) # send right combination
actions.perform()
sleep(2)
actions = ActionChains(driver)
actions.send_keys(Keys.TAB * 4 + Keys.ENTER) # confirm
actions.perform()
sleep(5) # wait some time to finish
driver.quit() # close this tab
driver.switch_to.window(driver.window_handles[0]) # switch back
@Maik7 thanks! @ChrizZz90 although technically possible, booking appointments automatically is not in the spirit. Human interaction should always be required to avoid appointments being booked accidentally e.g. the next day at 8am and the user not knowing about it, resulting in appointments not being attended.
Cache cleaning function is interesting – not sure where we could use it though.
I used cache cleaning first after opening a browser window every time, on a later stage I reduced it and I call it if I am shadowbanned.
Appointments are scheduled at least 24h before, every appointment later is directly handed to the center itself and they use people on their waiting list. This is probably a human process with issues and mistakes, but I can confirm that it never happened to get an appointment in less then 24 hours. Do you have other experiences?
Hey @ChrizZz90, that's not true – appointments can also appear the day before, with the appointment being literally the next morning. Had it happen to me too; got one on Sunday for Monday at 0830.
Interesting. Did cache clearing have a positive impact? I honestly think cookies need to have a certain age for everything to work better, but may be a wrong feeling. Instead we could also use incognito
sessions.
Wow, damn, I thought they would stick to their rules.
I don't know if it has an impact. Tests are influenced by the waiting list and other scripts I am running. Clearing the cache just gives me a positive feeling that I did everything to solve it.
Ich bekomme die Fehlermeldung
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
Any Ideas? Arbeite mit MacOS 11.2.3, falls das wichtig ist - Super Teil und Idee jedenfalls!
@grimconquerer einfach noch mal pip
drüberlaufen lassen. Sollte einfach funktionieren. BR
I have been trying to book an appointment with an existing Vermittlungscode. I have now encountered the same issue twice, where I have an appointment show up, I fill everything out, click to confirm the appointment, but then the website tells me that the appointment is already taken, even though it is still within my reservation period.
Has anybody else encountered that problem or have an explanation?
with todays improvements I get on win10 a chrome error: "Google Chrome kann I'm folgenden Datenverzeichnis weder lessen noch schreiben: selenium." Any hint on how to solve it?
I also get selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
I have been trying to book an appointment with an existing Vermittlungscode. I have now encountered the same issue twice, where I have an appointment show up, I fill everything out, click to confirm the appointment, but then the website tells me that the appointment is already taken, even though it is still within my reservation period.
Has anybody else encountered that problem or have an explanation?
Had the same today, I thought this is caused by the impfterminservice platform.
@marcoreuter this issue is caused by the ImpfterminService – unfortunately they sometimes send the same appointment out to two people at the same time. Nothing we can really do about it. Don't worry, tomorrow is another day.
@ChrizZz90 can you open constructors.py
and replace the line opts.add_argument('--user-data-dir=selenium')
with opts.add_argument('--user-data-dir=./selenium')
and see if that fixes it for you? Thanks for reporting this
@alfonsrv that doesn't solve the issue. Commenting this line out lets me start Selenium, but I get missing cookies errors.
Using the chrome default path works for me. Is Chrome not allowed to write in other directories?
@ChrizZz90 should be fixed now. Just pushed a commit. BR
@alfonsrv works! Thanks for the quick update
You've added readline in your code. Now the impfbot fails to launch with
Traceback (most recent call last): File "C:\Users\XXX\Desktop\impf-botpy\main.py", line 7, in <module> import readline ModuleNotFoundError: No module named 'readline'
You should probably add pyreadline to your requirements.txt. I have fixed it with:
pip3 install pyreadline --user
@bguenthner cheers for the heads-up.
First of all, thank you very much for the project!!
I have the problem with BOOK_REMOTLEY that the second alert with the appointments is not send to telegram:
fappointments = format_appointments(appointments.get('termine'))
send_alert(settings.ALERT_BOOKINGS.replace('{{ APPOINTMENTS }}', ' \n'.join(fappointments)))
I tested it calling send_alert() with a simple string twice and it worked perfectly. When I add the original code with a dummy appointment string to the second call it does not arrive in the telegram chat.
Any ideas?
Either a rate limiting issue on the side of Telegram or the API simply does not return any appointments in your case. But that's why the link is usually appended to the alert & a recommendation to setup a remote access tool such as AnyDesk
.
Hi, Same here. But Zulip worked fine with the same message. And the link in the first telegram message is working fine, too. Regards, Maik
I accessed the machine via TeamViewer
and the log always showed a valid appointment as well as the website. Could it be invalid formatting?
Edit: Okay I found it, it is invalid formatting. Telegram does not seem to like the *
in front of the appointments listing:
f'* {_format_appointments(appointment)} (appt:{i + 1})'
What would be a preferred other symbol for the listing? -
How does the automatic booking work, do I need to enter appt:1
as answer in the chat? Because when I click the appoints request link it won't work, the server probbably sees a different IP and directly kills the reservation.
@ratatonga - the link does not always work first try; just keep on trying. Didn't get consistent results either, but when it works it's pretty satisfying. You should be able to answer appt:1
in chat and then the appointment should be booked given your credentials, but here too success is not guaranteed. I'm just building backups.
Telegram is fine with the **Verfügbare Termine**
?
@ratatonga - the link does not always work first try; just keep on trying. Didn't get consistent results either, but when it works it's pretty satisfying. You should be able to answer
appt:1
in chat and then the appointment should be booked given your credentials, but here too success is not guaranteed. I'm just building backups. Telegram is fine with the**Verfügbare Termine**
?
It's not that one, it's the one in the listing:
2021-05-26 13:26:19,846 - [INFO] <impf.alert.alert.py:63> Sending alert " **Verf�gbare Termine:**
* Do, 27.05.2021 - 17:48 Uhr x Do, 08.07.2021 - 13:30 Uhr (appt:1)"
Also the **
has no effect.
Works with -
? I think -
should also be ok for most Markdown parsers, so a switch would be easily possible.
Works with
-
? I think-
should also be ok for most Markdown parsers, so a switch would be easily possible.
Works =)
good catch! Maybe its the as the first character of a line? `'text': message.replace(' ','- ')` could do the job within telegram_send could be an easy fix?
just found this: Telegram's versions of MarkDown: Markdown & Markdown v2 don't support any sort of lists...
Feature Requests
To avoid cluttering the issue tracker with feature requests, please comment any requests here and we'll keep a list.
When available, I've linked a related issue or comment to add context to the request.
Emoji Feedback Scale
Helped you? Support this project!