Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
clicsante
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Romain Lebbadi-Breteau
clicsante
Commits
2ef1a21b
Commit
2ef1a21b
authored
3 years ago
by
Romain Lebbadi-Breteau
Browse files
Options
Downloads
Patches
Plain Diff
Initial commit
parents
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
script.py
+63
-0
63 additions, 0 deletions
script.py
with
63 additions
and
0 deletions
script.py
0 → 100644
+
63
−
0
View file @
2ef1a21b
#!/usr/bin/env python3
from
datetime
import
date
import
requests
API_URL
=
"
https://api3.clicsante.ca/v3/
"
today
=
date
.
today
()
dateStart
=
today
dateStop
=
"
2021-05-26
"
postal_code
=
"
H3S 2C8
"
blacklist
=
[
60070
,
60124
,
60121
,
60142
]
headers
=
{
"
authorization
"
:
"
Basic cHVibGljQHRyaW1vei5jb206MTIzNDU2Nzgh
"
,
"
x-trimoz-role
"
:
"
public
"
,
"
product
"
:
"
clicsante
"
}
geoData
=
requests
.
get
(
API_URL
+
"
geocode
"
,
params
=
{
"
address
"
:
postal_code
},
headers
=
headers
)
coordinates
=
geoData
.
json
()[
"
results
"
][
0
][
"
geometry
"
][
"
location
"
]
centersParams
=
{
"
dateStart
"
:
dateStart
,
"
dateStop
"
:
dateStop
,
"
latitude
"
:
coordinates
[
"
lat
"
],
"
longitude
"
:
coordinates
[
"
lng
"
],
"
maxDistance
"
:
20
,
"
serviceUnified
"
:
237
,
"
postalCode
"
:
postal_code
,
"
page
"
:
0
}
centers
=
[]
centersData
=
requests
.
get
(
API_URL
+
"
availabilities
"
,
params
=
centersParams
,
headers
=
headers
)
while
centersData
.
status_code
==
200
:
centers
+=
centersData
.
json
()[
"
places
"
]
centersParams
[
"
page
"
]
+=
1
centersData
=
requests
.
get
(
API_URL
+
"
availabilities
"
,
params
=
centersParams
,
headers
=
headers
)
for
center
in
centers
:
if
center
[
'
establishment
'
]
in
blacklist
:
continue
servicesData
=
requests
.
get
(
API_URL
+
f
"
establishments/
{
center
[
'
establishment
'
]
}
/services
"
,
headers
=
headers
)
serviceId
=
servicesData
.
json
()[
0
][
"
id
"
]
scheduleParams
=
{
"
dateStart
"
:
dateStart
,
"
dateStop
"
:
dateStop
,
"
service
"
:
serviceId
,
"
timezone
"
:
"
America/Toronto
"
}
scheduleData
=
requests
.
get
(
API_URL
+
f
"
establishments/
{
center
[
'
establishment
'
]
}
/schedules/public
"
,
params
=
scheduleParams
,
headers
=
headers
)
availableDates
=
scheduleData
.
json
()[
"
availabilities
"
]
if
len
(
availableDates
)
>
0
:
url
=
f
"
https://clients3.clicsante.ca/
{
center
[
'
establishment
'
]
}
/take-appt?unifiedService=237&portalPlace=
{
center
[
'
id
'
]
}
&portalPostalCode=
{
postal_code
.
replace
(
'
'
,
'
%20
'
)
}
&lang=fr
"
print
(
f
"
Centre :
{
center
[
'
name_fr
'
]
}
\n
Lien :
{
url
}
\n
Lieu :
{
center
[
'
formatted_address
'
]
}
\n
Dates :
\n
"
)
for
date
in
availableDates
:
print
(
f
"
-
{
date
}
"
)
print
(
""
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment