Skip to content

Instantly share code, notes, and snippets.

@BlakeStevenson
Last active March 13, 2025 14:35
Show Gist options
  • Save BlakeStevenson/e0323256e4395752b6fea814d5e5ebcc to your computer and use it in GitHub Desktop.
Save BlakeStevenson/e0323256e4395752b6fea814d5e5ebcc to your computer and use it in GitHub Desktop.
Create an appointment at the Texas DPS at the closest location, soonest time, programatically.
const axios = require('axios');
async function getLocations() {
const locationsData = await axios.post("https://publicapi.txdpsscheduler.com/api/AvailableLocation", {
"TypeId": 71,
"ZipCode": "10001",
"CityName": "",
"PreferredDay": 0
});
return locationsData.data;
}
async function getTimes(lid) {
const timeData = await axios.post("https://publicapi.txdpsscheduler.com/api/AvailableLocationDates", {
LocationId: lid,
TypeId: 71,
SameDay: false,
StartDate: null,
PreferredDay: 0
});
return timeData.data;
}
async function createAppointment(time, site, respId) {
const appointmentData = await axios.post("https://publicapi.txdpsscheduler.com/api/NewBooking", {
"CardNumber": "",
"FirstName": "Blake",
"LastName": "Stevenson",
"DateOfBirth": "mm/dd/yyyy",
"Last4Ssn": "ssn4",
"Email": "[email protected]",
"CellPhone": "(123) 456-7890",
"HomePhone": "",
"ServiceTypeId": 71,
"BookingDateTime": time, //2020-10-16T08:00:00
"BookingDuration": 45,
"SpanishLanguage": "N",
"SiteId": site,
"SendSms": false,
"AdaRequired": false,
"ResponseId": respId
});
return appointmentData.data;
}
async function getResponseId() {
const respIdData = await axios.post("https://publicapi.txdpsscheduler.com/api/Eligibility", {
"FirstName": "Blake",
"LastName": "Stevenson",
"DateOfBirth": "mm/dd/yyyy",
"LastFourDigitsSsn": "ssn4",
"CardNumber": ""
});
return respIdData.data[0].ResponseId;
}
(async () => {
// get response id
const responseId = await getResponseId();
console.log(responseId);
// get locations
const locations = await getLocations();
console.log(locations[0]);
// get times
const times = await getTimes(locations[0].Id);
console.log(times.LocationAvailabilityDates[0]);
// create appointment
const appointment = await createAppointment(times.LocationAvailabilityDates[0].AvailableTimeSlots[0].StartDateTime, locations[0].Id, responseId);
console.log(appointment);
this.appointment = appointment;
})();
@zakaryaalsaba
Copy link

SSL: CERTIFICATE_VERIFY_FAILED:
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\urllib3\connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\urllib3\connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "C:\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1042, in validate_conn
conn.connect()
File "C:\Python311\Lib\site-packages\urllib3\connection.py", line 419, in connect
self.sock = ssl_wrap_socket(
^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\urllib3\util\ssl
.py", line 449, in ssl_wrap_socket
ssl_sock = ssl_wrap_socket_impl(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\urllib3\util\ssl
.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\ssl.py", line 517, in wrap_socket
return self.sslsocket_class._create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\ssl.py", line 1075, in _create
self.do_handshake()
File "C:\Python311\Lib\ssl.py", line 1346, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\urllib3\connectionpool.py", line 787, in urlopen
retries = retries.increment(
^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\urllib3\util\retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='publicapi.txdpsscheduler.com', port=443): Max retries exceeded with url: /api/AvailableLocation (Caused by SSLError(SSLCertVerificationError(1,
'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Vue\DMVQuery\makebooking.py", line 199, in
main()
File "C:\Vue\DMVQuery\makebooking.py", line 141, in main
results = get_available_locations()
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Vue\DMVQuery\makebooking.py", line 120, in get_available_locations
response = requests.request('POST', URL, headers=HEADERS, data=PAYLOAD)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\requests\api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\requests\sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\requests\sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\requests\adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='publicapi.txdpsscheduler.com', port=443): Max retries exceeded with url: /api/AvailableLocation (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:992)')))

@markdjones82
Copy link

How did you find out about the api? I don't see any info on it when googling.

@BlueMoon-Suhas
Copy link

How did you find out about the api? I don't see any info on it when googling.

anything worked out so far?

@markdjones82
Copy link

How did you find out about the api? I don't see any info on it when googling.

anything worked out so far?

I'm not sure what you are asking, but the only way to find it is from reverse engineering when going to the webpage. There is a good one out there that works here https://github.com/phamleduy04/texas-dps-scheduler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment