A package to fetch availability data from Calendly
Project description
calendly-fetcher
A code base using the Calendly API that fetches your calendar data and converts it into readable text format.
Usage
Use PyPI to install the package:
pip install calendly-fetcher
Set the CALENDLY_API_KEY
environment variable to your Calendly API key. You can get it from here.
export CALENDLY_API_KEY="your-api-key"
Check that your API key is set correctly (you should see your API key printed):
echo $CALENDLY_API_KEY
Then, you can use the package in Python as follows:
import os
from calendly_fetcher.calendly_fetcher import get_calendly_availability
# Set the API key (you can get it from https://calendly.com/integrations)
api_key = os.environ.get("CALENDLY_API_KEY")
Example
import os
import pytz
from datetime import datetime, timedelta
from calendly_fetcher.calendly_fetcher import get_calendly_availability, convert_basic_date_to_datetime
# Set the API key (you can get it from https://calendly.com/integrations)
api_key = os.environ.get("CALENDLY_API_KEY")
# set start and end dates
start_date = "09-01-2021"
end_date = "09-30-2021"
# convert the dates to datetime objects
start_date = convert_basic_date_to_datetime(start_date)
end_date = convert_basic_date_to_datetime(end_date)
# set your timezone
my_timezone = "America/New_York"
# get availability
availability = get_calendly_availability(api_key, start_date, end_date)
# print availability
for slot in availability:
if '30min' in slot['scheduling_url']:
duration = 30
slot['end_time'] = datetime.strptime(slot['start_time'], "%Y-%m-%dT%H:%M:%SZ") + timedelta(minutes=duration)
# convert the times from UTC to Eastern Time
utc_start_time = datetime.strptime(slot['start_time'], '%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=pytz.utc)
local_start_time = utc_start_time.astimezone(pytz.timezone(my_timezone))
utc_end_time = slot['end_time'].replace(tzinfo=pytz.utc)
local_end_time = utc_end_time.astimezone(pytz.timezone(my_timezone))
print(f"Available: {local_start_time} - {local_end_time}")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file calendly-fetcher-0.1.2.tar.gz
.
File metadata
- Download URL: calendly-fetcher-0.1.2.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95a14fd66131c041644b0695983d463ac9e3c83c24fb90052f231b2390c9bc1e |
|
MD5 | 5e73c6f192ac072346b1e2bd40de4b50 |
|
BLAKE2b-256 | 0eee0c660d7e00a1cfd8dd1ff8b5f355f3d0195dbf5c2feb6f6cd77665633f61 |
File details
Details for the file calendly_fetcher-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: calendly_fetcher-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91a655c3ba2ed40e1550343c3a4b7d09772ccb9f0994091864807e83bc783a18 |
|
MD5 | a51caa458c0e12c877a00b7e11c6f8bf |
|
BLAKE2b-256 | 90ffb01e5f027183c2343d052013275af4ae4bd35dd5ec7d3bc504ce3f03d579 |