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 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 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")
# set start and end dates
start_date = "09-01-2021"
end_date = "09-30-2021"
# 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.0.tar.gz
.
File metadata
- Download URL: calendly-fetcher-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5b1716d7df3c1f8000f1447a8d0ba2d66c2d6602c55a1bdaa88e0729d3f6a28 |
|
MD5 | 83c9936dd546744ee2c7bcbf59308430 |
|
BLAKE2b-256 | e0dbd5bc791ee50f9127a8f516fd678b3d7f3371ac4b1f1a8f1deb6c3343fb85 |
File details
Details for the file calendly_fetcher-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: calendly_fetcher-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.5 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 | 183ce50b78b84775ffdcb975faa0838cd73a238ab5d300472999c9591a35845b |
|
MD5 | 19ec13a2368f6a00db06328a491d0d2c |
|
BLAKE2b-256 | e2394b8d7d22c78e3816f07985264d81e080219f0039470938b1a00c23a560ef |