This is the code-based behind the Twitter account @ukpassportcheck.
Nothing is hidden. I code in the open. You can see all the code here and select Actions
tab
to see the GitHub Actions in progress.
The code is split into two parts - both use the Python package tweepy
to post to Twitter:
A simple requests
script to check whether the following UK Passport services are available:
Once a service goes online, the bot checks what appointments are available. For Fast Track, we use
Ajax requests to pass information to the server
(about Ajax requests).
For Premium, we use a series of POST
and GET
requests. We used to use selenium
but our new method is
much faster and has fewer errors! Then bot keeps checking and posts again if more appointments are added
on either service.
git clone https://github.com/mshodge/youshallnotpassport.git
pip install -r requirements.txt
python main.py
python find_appointments_fast_track.py
python find_appointments_premium.py
To post to Twitter you will need elevated v1 access on the Twitter Developer site. Then create a
file called twitter_credentials.py
in /config/
with the following:
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
Add proxy settings to a proxies.py
file in /config/
if you require them.
Change the is_proxy
to be True
in main.py
.