GithubHelp home page GithubHelp logo

visa_rescheduler's Introduction

visa_rescheduler

US VISA (ais.usvisa-info.com) appointment re-scheduler - Colombian adaptation

Prerequisites

  • Having a US VISA appointment scheduled already
  • Google Chrome installed (to be controlled by the script)
  • Python v3 installed (for running the script)
  • API token from Pushover and/or a Sendgrid (for notifications)

Initial Setup

  • Create a config.ini file with all the details required
  • Install the required python packages: pip3 install -r requirements.txt

Executing the script

  • Simply run python3 visa.py
  • That's it!

Acknowledgement

Thanks to @yaojialyu for creating the initial script and to @cejaramillof for adapting it to Colombia!

visa_rescheduler's People

Contributors

breakertt avatar cejaramillof avatar duvanmonsa avatar oscardtorresb avatar uxdaniel avatar yaojialyu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

visa_rescheduler's Issues

DATE_URL does not work

DATE_URL returns 404 even on my browser with the correct setting.

Anyone seen similar issue?

Timeout Exception After Login

Hi, it always shows a TimeoutException(message, screen, stacktrace) after login is successful. Why is this happening?

Bans

Hi there! Any way or setting to avoid being banned for 5hs after a number of requests? I've been struggling with that but no success yet. I also don't understand the banning criteria

ASC appointment

Since there is no ASC appointment part, this program is not working right now.

Best retry times?

Hi Everyone,
I though i'd open an issue where all of us share what are the best retry times they managed to get without bans :
My knowledge so far - Max retry times i managed to get without ban:

RETRY_TIME = 605 # wait time between retries/checks for available dates: 5 minutes
EXCEPTION_TIME = 60
30 # wait time when an exception occurs: 30 minutes
COOLDOWN_TIME = 60*60

I read some guy in reddit said he thinks the max amount of times in an hour is 40 but whenever i go over 30 it crashes for me.

FACILITY_ID location

Hey guys, where i can find FACILITY_ID? As i understand it's ID of embassy, but it's not clear where to find it. Thanks.

Website not working anymore

After using the bot for two consecutive days, I can't access my account. Am I banned, or does someone else have the same problem?

Issue reschedule with groups

Hi Guys,

I tried to run the script. Script runs fine until login than it does nothing. FYI I am trying to reschedule for my family all are under one account.

Seps:
1: login successfull
2: stuck on group page where it needs to click continue (see attach)
Screenshot 2022-09-22 at 13 35 18

following are the steps I have to take before rescheduling the appointment.

Screenshot 2022-09-22 at 13 35 18
Screenshot 2022-09-22 at 13 35 43
Screenshot 2022-09-22 at 13 35 51
Screenshot 2022-09-22 at 13 36 04
Screenshot 2022-09-22 at 13 36 18

Stuck on Log-in Page

It was working perfectly fine for months but suddenly stop working for the past 2 days. Program not able to continue in the log in page.

Capture
image

stuck on last step before "login sucessful"

I am geting a timeout from line 147: Wait(driver, 60).until( EC.presence_of_element_located((By.XPATH, REGEX_CONTINUE)))

It seems like this line is trying to locate the continue button? If it doesn't do anything specific, can it be commented out? I have no clue why it is not working. Can anyone please help? Thanks!

Below is the error message I got:
Wait(driver, 60).until( EC.presence_of_element_located((By.XPATH, REGEX_CONTINUE)))
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/support/wait.py", line 87, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:

New Retry times for not getting banned

Can some suggest new times for not getting banned

STEP_TIME = 0.5 # time between steps (interactions with forms): 0.5 seconds
RETRY_TIME = 6010 # wait time between retries/checks for available dates: 10 minutes
EXCEPTION_TIME = 60
30 # wait time when an exception occurs: 30 minutes
COOLDOWN_TIME = 60*60 # wait time when temporary banned (empty list): 60 minutes

Reschedule failed

any ideas why this happens? it failed to schedule. usually it says failed to schedule and works this time it didnt :( also I never get a notification
image

Unable to book

Hi everyone, thank you much for this repo!

The code has been running and once it found an appointed it prompted the message "failed to book", 1. however, upon checking I noticed that the appointment has in fact been changed. I adjusted the dates and run again, 2. it found an appointment but it failed to book, this time when I checked it actually did not change. 3. I run the code a third time, it said succssefuly booked, however it did not change the dates :(

please advise :D

NoSuchElementException: {"method":"css selector","selector":"[name="utf8"]"}

I encountered such exception when it finds a right time slot and starts to reschedule.

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="utf8"]"}

It comes from def reschedule(date) method. Is there anything changed in reschedule page?

Please update webdriver.Chrome installation line

Please update the following line:
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
to just:
driver = webdriver.Chrome()
so there are no issues with the new chrome releases and links to them. silennium will update webdriver automatically

A beginner's question

I am a beginner in Python, I have installed requirements.txt, and reported this error when running this visa.py, I want to know how to solve it, thank you!

Gibhub issue

driver error

There is no error in the code, but Chrome does not open and the script closes without any errors. What could be the reason for this? Need urgent help.

Fake date and No time

It happened to me twice.. code gets an early date. But it says "None" for time and rescheduling fails!

Unable to go to Login screen

hello I am stuck at the previous screen and cannot go past the continue and go login screen.

I am using a bit of a different code, the code is below, if anyone can review it and help me?

-- coding: utf8 --

import time
import random
import configparser
from datetime import datetime
import argparse

import requests
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait as Wait
from selenium.webdriver.common.by import By
from webdriver_manager.chrome import ChromeDriverManager

parser = argparse.ArgumentParser()
parser.add_argument("--config", default='config10.ini')
args, unknown = parser.parse_known_args()

config = configparser.RawConfigParser()
config.read(args.config)

USERNAME = config['USVISA']['USERNAME']
PASSWORD = config['USVISA']['PASSWORD']
SCHEDULE_ID = config['USVISA']['SCHEDULE_ID']
COUNTRY_CODE = config['USVISA']['COUNTRY_CODE']

PUSH_TOKEN = config['PUSHOVER']['PUSH_TOKEN']
PUSH_USER = config['PUSHOVER']['PUSH_USER']

LOCAL_USE = config['CHROMEDRIVER'].getboolean('LOCAL_USE')
HUB_ADDRESS = config['CHROMEDRIVER']['HUB_ADDRESS']

REGEX_CONTINUE = "//a[contains(text(),'Continue')]"

STEP_TIME = 0.5 # time between steps (interactions with forms): 0.5 seconds
RETRY_TIME = 60 * 10 # wait time between retries/checks for available dates: 10 minutes
EXCEPTION_TIME = 60 * 30 # wait time when an exception occurs: 30 minutes
COOLDOWN_TIME = 60 * 60 # wait time when temporary banned (empty list): 60 minutes

CONTINUE_URL = f"https://ais.usvisa-info.com/en-ca/niv/schedule/{SCHEDULE_ID}/continue_actions"
CONTINUE_URL2 = f"https://ais.usvisa-info.com/en-ca/niv/schedule/{SCHEDULE_ID}/continue"

def send_notification(msg):
print(f"Sending notification.")

if PUSH_TOKEN:
    url = "https://api.pushover.net/1/messages.json"
    data = {
        "token": PUSH_TOKEN,
        "user": PUSH_USER,
        "message": msg
    }
    requests.post(url, data)

def get_driver():
if LOCAL_USE:
dr = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
else:
dr = webdriver.Remote(command_executor=HUB_ADDRESS, options=webdriver.ChromeOptions())
return dr

driver = get_driver()

def login():
# Bypass reCAPTCHA
driver.get(f"https://ais.usvisa-info.com/{COUNTRY_CODE}/niv")
time.sleep(STEP_TIME)
a = driver.find_element(By.XPATH, '//a[@Class="down-arrow bounce"]')
a.click()
time.sleep(STEP_TIME)

print("Login start...")
href = driver.find_element(By.XPATH, '//*[@id="header"]/nav/div[2]/div[1]/ul/li[3]/a')
href.click()
time.sleep(STEP_TIME)
Wait(driver, 60).until(EC.presence_of_element_located((By.NAME, "commit")))

print("\tclick bounce")
a = driver.find_element(By.XPATH, '//a[@class="down-arrow bounce"]')
a.click()
time.sleep(STEP_TIME)

do_login_action()

def do_login_action():
print("\tinput email")
user = driver.find_element(By.ID, 'user_email')
user.send_keys(USERNAME)
time.sleep(random.randint(1, 3))

print("\tinput pwd")
pw = driver.find_element(By.ID, 'user_password')
pw.send_keys(PASSWORD)
time.sleep(random.randint(1, 3))

print("\tclick privacy")
box = driver.find_element(By.CLASS_NAME, 'icheckbox')
box .click()
time.sleep(random.randint(1, 3))

print("\tcommit")
btn = driver.find_element(By.NAME, 'commit')
btn.click()
time.sleep(random.randint(1, 3))

Wait(driver, 60).until(
    EC.presence_of_element_located((By.XPATH, REGEX_CONTINUE)))
print("\tlogin successful!")

def get_dates_new():

time.sleep(STEP_TIME)
driver.get(CONTINUE_URL)

time.sleep(STEP_TIME)
driver.get(CONTINUE_URL2)

time.sleep(STEP_TIME)
dates = driver.find_element(By.CLASS_NAME, 'for-layout').text

return dates

def main():
login()
retry_count = 0

while retry_count < 6:
    try:
        print("------------------")
        print(datetime.today())
        print(f"Retry count: {retry_count}")

        dates = get_dates_new()
        print(dates)
        if 'October, 2022' in dates or 'November, 2022' in dates:
            for el in dates.split('\n'):
                if '2022' in el:
                    send_notification(el)
                    print(el)

        if dates == 'Calgary No Appointments Available\nHalifax No Appointments Available\n' \
                    'Montreal No Appointments Available\nOttawa No Appointments Available\n' \
                    'Quebec City No Appointments Available\nToronto No Appointments Available\n' \
                    'Vancouver No Appointments Available':
            print('Banned')
            time.sleep(COOLDOWN_TIME)
            login()
        else:
            time.sleep(RETRY_TIME)

        print()

    except Exception as e:
        print(e)
        print('Banned')
        send_notification('Error')

        retry_count += 1
        time.sleep(EXCEPTION_TIME)

if name == "main":
main()

JSON URLs for checking dates and times are no longer valid

It seems that JSON URLs shown below are no longer valid. Any one have solutions or suggestions to check the available dates and times for each consulate and ASC appointment?

visa_rescheduler/visa.py

Lines 50 to 52 in b2bc1b0

DATE_URL = f"https://ais.usvisa-info.com/{COUNTRY_CODE}/niv/schedule/{SCHEDULE_ID}/appointment/days/{FACILITY_ID}.json?appointments[expedite]=false"
TIME_URL = f"https://ais.usvisa-info.com/{COUNTRY_CODE}/niv/schedule/{SCHEDULE_ID}/appointment/times/{FACILITY_ID}.json?date=%s&appointments[expedite]=false"
APPOINTMENT_URL = f"https://ais.usvisa-info.com/{COUNTRY_CODE}/niv/schedule/{SCHEDULE_ID}/appointment"

same issue on another repo: theoomoregbee/US-visa-appointment-notifier#25

selenium exception: WebDriverException disconnected

Hi guys,
Im running the program and after several runs i get this error and it fails to re-run after that, anyone knows how to solve this?

selenium.common.exceptions.WebDriverException: Message: disconnected: not connected to DevTools
(failed to check if window was closed: disconnected: not connected to DevTools)
(Session info: chrome=IP_ADDRESS)

Curious if this works with Mexican Facilities?

I am attempting to use this project to reschedule an appointment; however, was wondering if anyone has previously used this successfully with Mexican Facilities?

To reschedule an appointment I need to select one meeting (the main meeting) and then another meeting for biometrics, I'm not sure if this project is compatible with that setup / if Colombia is setup the same way. I only see a single post request for rescheduling which is making me question if different countries operate differently.

Thanks!

Is it really working ?

Hello, I would like to know if anyone has managed to get an earlier appointment using this script.
If i keep trying or it s not actually working

Error ?

Hello,
Sorry for any misspellings and typos, my English is poor and I used Google Translate.

I see the error shown below and the Chrome window closes by itself. Unfortunately, I have no knowledge of Python. I just adapted the codes here to my country.

Traceback (most recent call last):
File "C:\Users\ugur_\AppData\Local\Programs\Python\Python312\Scripts\visa.py", line 242, in
login()
File "C:\Users\ugur_\AppData\Local\Programs\Python\Python312\Scripts\visa.py", line 114, in login
do_login_action()
File "C:\Users\ugur_\AppData\Local\Programs\Python\Python312\Scripts\visa.py", line 138, in do_login_action
Wait(driver, 60).until(
File "C:\Users\ugur_\AppData\Local\Programs\Python\Python312\Lib\site-packages\selenium\webdriver\support\wait.py", line 95, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
GetHandleVerifier [0x0114CFE3+45267]
(No symbol) [0x010D9741]
(No symbol) [0x00FCBE1D]
(No symbol) [0x00FFED30]
(No symbol) [0x00FFF1FB]
(No symbol) [0x0102F772]
(No symbol) [0x0101B084]
(No symbol) [0x0102DDDA]
(No symbol) [0x0101AE36]
(No symbol) [0x00FF674E]
(No symbol) [0x00FF78ED]
GetHandleVerifier [0x01405659+2897737]
GetHandleVerifier [0x0144E78B+3197051]
GetHandleVerifier [0x01448571+3171937]
GetHandleVerifier [0x011D5E40+606000]
(No symbol) [0x010E338C]
(No symbol) [0x010DF508]
(No symbol) [0x010DF62F]
(No symbol) [0x010D1D27]
BaseThreadInitThunk [0x76A36839+25]
RtlGetFullPathName_UEx [0x77468F0F+1215]
RtlGetFullPathName_UEx [0x77468EDD+1165]

PS C:\Users\ugur_\AppData\Local\Programs\Python\Python312\Scripts>
python-hata

rescheduling doesnt work.

managed to get the script to work with 20 second intervals, the location im looking at is in high demand. however, the automated rescheduling isnt working and i have to manually select after an appointment has been found. has anyone fixed it?

Checking for an earlier date and nothing happens.

Does anyone having the same issue recently? i didn't have that issue before but recently when I run the script, it stuck at the section checking for an earlier date. Any possible update or solution?

image

How to handle the group application?

when create group appointment with 2 ppl, it will stuck as below errors
https://ais.usvisa-info.com/en-ca/niv/groups/

And app give below:
Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\support\wait.py", line 87, in until
raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
Backtrace:
(No symbol) [0x005437D3]
(No symbol) [0x004D8B81]
(No symbol) [0x003DB36D]
(No symbol) [0x0040D382]
(No symbol) [0x0040D4BB]
(No symbol) [0x00443302]
(No symbol) [0x0042B464]
(No symbol) [0x00441215]
(No symbol) [0x0042B216]
(No symbol) [0x00400D97]
(No symbol) [0x0040253D]
GetHandleVerifier [0x007BABF2+2510930]
GetHandleVerifier [0x007E8EC1+2700065]
GetHandleVerifier [0x007EC86C+2714828]
GetHandleVerifier [0x005F3480+645344]
(No symbol) [0x004E0FD2]
(No symbol) [0x004E6C68]
(No symbol) [0x004E6D4B]
(No symbol) [0x004F0D6B]
BaseThreadInitThunk [0x75DA00F9+25]
RtlGetAppContainerNamedObjectPath [0x76FE7BBE+286]
RtlGetAppContainerNamedObjectPath [0x76FE7B8E+238]

Final booking step is erroring out and returning html

Hi everyone and thanks for all your work on this project.

The program is working for me up to the final booking step where I am getting an error: [Errno Expecting value] <!DOCTYPE html> followed by html for the login page.

Does anyone know if the required headers have changed? Right now I'm just using User-Agent, Referer, and Cookie.

Thanks!

Schedule ID?

Hi, I would like to know what is schedule ID? and where can it be found?

Reschedule Raises Exception - connection aborted, remove end closed connection without response

I managed to run the rescheduler but ran into an exception in the reschedule function.

The exception occurred when sending the post request to server
requests.post(APPOINTMENT_URL, headers=headers, data=data)
https://github.com/Soroosh-N/us_visa_scheduler/blob/main/visa.py#L174

The exception message is
Connection aborted, RemoteDisconnected, Remote end closed connection without response

Is it a sign that the server temporarily blocked my account? Any help is appreciated!

Not sure what is wrong while rescheduling

INFO:login - Login start...
INFO:login - click bounce
INFO:do_login_action - input email
INFO:do_login_action - input pwd
INFO:do_login_action - click privacy
INFO:do_login_action - commit
INFO:do_login_action - login successful!
INFO:print_dates - Available dates:
INFO:print_dates - 2023-12-05 business_day: True
INFO:get_available_date - Checking for an earlier date:
INFO:is_earlier - Is 2024-08-07 00:00:00 > 2023-12-05 00:00:00: True
INFO:get_time - Got time successfully! 2023-12-05 10:30
INFO:main - New date: 2023-12-05 10:30
INFO:asc_availability - ASC Availability
INFO:send_notification - Sending notification: HELP! Crashed.
ERROR:main - unhashable type: 'slice'

Seems like script is not working while rescheduling. How can we fix it?

Reschedule failed! Wrong time

Available dates:
2025-08-18, 2025-08-28,
Got time successfully! 2025-08-28 09:45
Reschedule Failed!!! 2025-08-28 09:45
Sending notification!

Everything is working fine, apart from rescheduling. I was doing testing with rescheduding and can see it fetches time which is not coming up online and later Reschedule gets failed! Any fix?

Multiple cities selection

Is it possible to choose not only one, but maybe two or three locations for rescheduling the appointment?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.