Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Clockify/Clockify_Get_all_my_workspaces.ipynb
2973 views
Kernel: Python 3

Clockify.png

Clockify - Get all my workspaces

Give Feedback | Bug report

Tags: #clockify #api #workspace #get #python #rest

Last update: 2023-04-12 (Created: 2023-04-05)

Description: This notebook will show how to get all workspaces of a user using the Clockify API and return a dict.

Input

Import libraries

import requests import naas from pprint import pprint

Setup Variables

api_key = naas.secret.get("CLOCKIFY_API_KEY") or "YOUR_API_KEY"

Model

Get all workspaces

This function will get all workspaces of a user using the Clockify API.

def get_workspaces(api_key): url = "https://api.clockify.me/api/workspaces" headers = {"X-Api-Key": api_key} response = requests.get(url, headers=headers) return response.json() workspaces = get_workspaces(api_key)

Output

Display result

print("Workspaces found:", len(workspaces), "\n") pprint(workspaces)