[PYTHON] [Ota Ward] Check the status of application processing for special flat-rate benefits

Overview

You can now check the Online application status of special fixed-amount benefits on the Ota Ward website. If you are applying online, use Beautiful Soup because you can know your application status from the reception number. I will try to get information such as application status.

Get HP update date

The modification date and time can be obtained from the Last-Modified response header.

print(res.headers['Last-Modified'])

#Output Mon, 25 May 2020 08:49:00 GMT

Acquisition of application processing status

The application status can be obtained from the ul and li tags in id = "main". You can get a list including application status by specifying with select ().

If you have applied online, you will be issued a reception number so you can compare it with your own number to know the current status.

申請状況.png
import requests, bs4
import re

res = requests.get('https://www.city.ota.tokyo.jp/cyuumokujoho/infection/kyufu/teigakukyuuhuonlinejokyo.html')
res.raise_for_status()
soup = bs4.BeautifulSoup(res.content, "html.parser")
elements = soup.select('#main ul li')

kyufu = 0
next = 0
for element in elements:
    text = element.getText()
    
    if 'Number of applications' in text:
        print(text)
    if 'Benefit decision status' in text:
        print(text)
        kyufu = re.findall('[0-9]+', text)[0]
    if 'Scheduled to be decided next time' in text:
        print(text)
        next = re.findall('[0-9]+', text)[0]

number = 200503009999999
if int(kyufu) > number:
    print("The application processing status is now the benefit decision status.")
elif int(next)  > number:
    print("The application processing status will be decided next time.")
else:
    print("The application processing status is awaiting examination.")
#output
Number of applications 23,848 cases
Benefit decision status Until reception number 200502004219879 Benefit decision
Scheduled to be decided next time Until reception number 200506012800746

The application processing status will be decided next time.

Get the status of the transfer date

A guideline for the transfer date is also provided from the application date. You can get it from the p tag in id = "main" as well as the application status.

給付状況.png
elems = soup.select('#main p')

print(elems[4].getText().replace('。5', '。\n5'))
#output
Applications for May 1st (Friday): The transfer will be completed by 26th (Tuesday) (excluding applications for which there was an input error, etc. The same shall apply hereinafter).
Application for May 2nd (Saturday): Transfers will be made on 26th (Tuesday), 29th (Friday), and June 2nd (Tuesday).
May 3rd (Sunday) Application: The transfer will start from June 2nd (Tuesday).
Application for May 4th (Monday): Transfer will start from June 2nd (Tuesday).
Application for May 5th (Tuesday): Transfer will start from June 2nd (Tuesday).
May 6th (Wednesday) Application: Transfer will start from June 2nd (Tuesday).
May 7th (Thursday) Application: The transfer will start from June 5th (Friday).
Applications after Friday, May 8 will also be transferred in sequence. Note: The transfer schedule is a guide. Please note that it may take some time depending on the progress and input errors.

reference

[Python] Get the last updated date of the website Beautiful Soup to understand in 10 minutes

Recommended Posts

[Ota Ward] Check the status of application processing for special flat-rate benefits
Image processing? The story of starting Python for
Check the status of your data using pandas_profiling
Check the processing time and the number of calls for each process in python (cProfile)
Check for the existence of BigQuery tables in Java
Check the operation of Python for .NET in each environment
Check the memory status of the server with the Linux free command
Check the operating status of the server with the Linux top command
The image display function of iTerm is convenient for image processing.
Check the increase / decrease of Bitcoin for each address from the blockchain
Check the memory protection of linux kerne with the code for ARM
for, continue, break Explain the flow of iterative processing in Python3-Part 1