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}")
Metadata
Release files for calendly-fetcher 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| calendly-fetcher-0.1.2.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| calendly_fetcher-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.8 kB
Release files / calendly-fetcher-0.1.2.tar.gz
| Download URL | calendly-fetcher-0.1.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95a14fd66131c041644b0695983d463ac9e3c83c24fb90052f231b2390c9bc1e
|
|
BLAKE2b-256 checksum How to use checksums |
0eee0c660d7e00a1cfd8dd1ff8b5f355f3d0195dbf5c2feb6f6cd77665633f61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|
Release files / calendly_fetcher-0.1.2-py3-none-any.whl
| Download URL | calendly_fetcher-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
91a655c3ba2ed40e1550343c3a4b7d09772ccb9f0994091864807e83bc783a18
|
|
BLAKE2b-256 checksum How to use checksums |
90ffb01e5f027183c2343d052013275af4ae4bd35dd5ec7d3bc504ce3f03d579
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.13
|