Giter Club home page Giter Club logo

udiinformer's Introduction

Appointment availability checker for UDI, Norway

Norwegian Directorate of Immigration (UDI) is open with limited offers due to corona crisis. Those living in Oslo area may be faced with a message that there are no available appointments:

error

Note that there is no "Notify me when there is one" button. Heh? We live in a 21st century and UDI's suggests to "... you can log in regularly and check if there are available appointments for your application type."

This repo can be used to automate this task.

What it does

This is a small script (main.py) that logins to UDI with your personal credentials, opens the very first application and checks if there is an error message presented on the page. If there is no error message, then the script will send a message and page screenshot to a Telegram bot.

There is another script (rebook.py), which may be used to check newly available spots that are earlier than your booked appointment. This may be useful when you've booked time at UDI, but still would like to reschedule it to an earlier slot. Such slots open up from time to time when other people give up their time.

Limitations

  • These scripts can not be used with applications for the citizenship. There is an app in the Windows store, which doesn't have the above limitations. It is easy to install and use. Notifies you on the computer itself and on e-mail. Check it out if you are on Windows! Link: https://www.microsoft.com/store/apps/9P525JWRRMT2
  • As of 25.09.2022, UDI changed the inner structer of their website. These scripts won't work out of the box and will need modifications. The app from Windows store supports new changes.

Usage

You will need to create your own Telegram Bot. It is very easy, see https://telegram.me/BotFather .

  1. Create python virtual environment.
  2. Clone the code git clone https://github.com/fralik/udiinformer.git.
  3. Go to the repo folder and run:
    pip install -r requirements.txt
    python -m playwright install
    telegram-send.exe --configure
    
  4. Provide your credentials. You have several options (choose one):
    • Copy .env.example to .env and modify it.
    • Set environment variables UDI_EMAIL, UDI_PWD.
    • Modify main.py file and provide your credentials right in the source code. to write your credentials there.
  5. python main.py for available time slot script and python rebook.py in order to find rebooking possibility.

I advise to use this script from a cron job or scheduled task.

udiinformer's People

Contributors

fralik avatar mrtnb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

udiinformer's Issues

Error in telegram-send.exe --configure

Hi
I receive this error when I run telegram-send.exe --configure:

telegram-send.exe : The term 'telegram-send.exe' is not recognized as the name of a cmdlet, function, script file, or operable program. C
heck the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • telegram-send.exe --configure
  •   + CategoryInfo          : ObjectNotFound: (telegram-send.exe:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    

Timeout

Hello,

it worked until step 5. I got this in my terminal:

(udiinformer) ljmmbp:udiinformer username$ python main.py
Traceback (most recent call last):
  File "/Users/username/udiinformer/udiinformer/main.py", line 70, in <module>
    main()
  File "/Users/username/udiinformer/udiinformer/main.py", line 47, in main
    page.click(
  File "/Users/username/udiinformer/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 6624, in click
    self._sync(
  File "/Users/username/udiinformer/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 103, in _sync
    return task.result()
  File "/Users/username/udiinformer/lib/python3.10/site-packages/playwright/_impl/_page.py", line 577, in click
    return await self._main_frame.click(**locals_to_params(locals()))
  File "/Users/username/udiinformer/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 393, in click
    await self._channel.send("click", locals_to_params(locals()))
  File "/Users/username/udiinformer/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 36, in send
    return await self.inner_send(method, params, False)
  File "/Users/username/udiinformer/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 54, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for selector "#ctl00_BodyRegion_PageRegion_MainRegion_ApplicationOverview_applicationOverviewListView_ctrl0_btnBookAppointment"
============================================================
Note: use DEBUG=pw:api environment variable to capture Playwright logs.

If I inspect the "selfservice.udi.no" site, it looks like the structure of the website has changed. So I wanted to ask, if this script works.

Thanks a lot

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.