Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

calendly-fetcher-0.1.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

calendly_fetcher-0.1.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

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

Hashes for calendly-fetcher-0.1.2.tar.gz
Algorithm Hash digest
SHA256 95a14fd66131c041644b0695983d463ac9e3c83c24fb90052f231b2390c9bc1e
MD5 5e73c6f192ac072346b1e2bd40de4b50
BLAKE2b-256 0eee0c660d7e00a1cfd8dd1ff8b5f355f3d0195dbf5c2feb6f6cd77665633f61

See more details on using hashes here.

File details

Details for the file calendly_fetcher-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for calendly_fetcher-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 91a655c3ba2ed40e1550343c3a4b7d09772ccb9f0994091864807e83bc783a18
MD5 a51caa458c0e12c877a00b7e11c6f8bf
BLAKE2b-256 90ffb01e5f027183c2343d052013275af4ae4bd35dd5ec7d3bc504ce3f03d579

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page