{ "info": { "author": "Matthew Downey", "author_email": "matthewdowney20@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# TogglPy\n\n[![Latest PyPI version](https://img.shields.io/pypi/v/TogglPy.svg)](https://pypi.org/project/TogglPy/)\n\nTogglPy is a python library for interacting with the [Toggl API](https://github.com/toggl/toggl_api_docs).\n\n# Features\n* Make requests against any (Toggl) API endpoint with request data as a dictionary\n* Generate and save PDFs of summary, weekly, or detailed reports\n* Fetch reports as JSON\n* Get all workspaces or all clients\n* Get a specific workspace or client, by id or name\n* Query projects, by client, or by a single name\n* Add custom time entries\n\n# Setup\n+ Install the project with pip:\n```shell\npip install -U TogglPy\n```\n+ Import the content: \n```python\nfrom toggl.TogglPy import Toggl\n```\n+ Create a Toggl object: \n```python\ntoggl = Toggl()\n```\n+ Authenticate either by Toggl credentials OR using [your personal API token](https://toggl.com/app/profile):\n```python\ntoggl.setAuthCredentials('', '') \n```\nOR:\n```python\ntoggl.setAPIKey('') \n```\n\n\n# I learn best by examples:\n### Manual GET requests against any Toggl endpoint:\n```python\nfrom toggl.TogglPy import Toggl\n\n# create a Toggl object and set our API key \ntoggl = Toggl()\ntoggl.setAPIKey(\"mytogglapikey\")\n\nresponse = toggl.request(\"https://www.toggl.com/api/v8/clients\")\n\n# print the client name and id for each client in the response\n# list of returned values can be found in the Toggl docs:\n# https://github.com/toggl/toggl_api_docs/blob/master/chapters/clients.md\nfor client in response:\n print \"Client name: %s Client id: %s\" % (client['name'], client['id'])\n```\nOr, if you want to add some data to your request:\n```python\ndata = {\n 'id': 42,\n 'some_key': 'some_value',\n 'user_agent': 'TogglPy_test',\n} \nresponse = toggl.request(\"https://www.toggl.com/api/v8/some/endpoint\", parameters=data)\n```\n\n### Making a POST request to any Toggl endpoint:\n```python\n\ndata = { \n \"project\": \n { \n \"name\": \"some project\", \n \"wid\":777, \n \"template_id\":10237, \n \"is_private\":true, \n \"cid\":123397 \n }\n }\n\nresponse = toggl.postRequest(\"https://www.toggl.com/api/v8/projects\", parameters=data)\n\n```\n\n\n### Generating PDF reports:\n```python\n# specify that we want reports from this week\ndata = {\n 'workspace_id': 0000, # see the next example for getting a workspace id\n 'since': '2015-04-27',\n 'until': '2015-05-03',\n}\n\n# download one of each type of report for this time period\ntoggl.getWeeklyReportPDF(data, \"weekly-report.pdf\")\ntoggl.getDetailedReportPDF(data, \"detailed-report.pdf\")\ntoggl.getSummaryReportPDF(data, \"summary-report.pdf\")\n```\n\n### Finding workspaces and clients\nThis will print some raw data that will give you all the info you need to identify clients and workspaces quickly:\n```python\nprint toggl.getWorkspaces()\nprint toggl.getClients()\n```\nIf you want to clean it up a little replace those print statements with\n```python\nfor workspace in toggl.getWorkspaces():\n print \"Workspace name: %s\\tWorkspace id:%s\" % (workspace['name'], workspace['id'])\nfor client in toggl.getClients():\n print \"Client name: %s\\tClient id:%s\" % (client['name'], client['id'])\n```\nIf you want to find a specific client or workspace:\n```python\njohn_doe = toggl.getClient(name=\"John Doe\")\npersonal = toggl.getWorkspace(name=\"Personal\")\n\nprint \"John's client id is %s\" % john_doe['id']\nprint \"The workspace id for 'Personal' is %s\" % personal['id']\n```\nThe reverse can also be done; use `.getClient(id=0000)` or `.getWorkspace(id=000)` to find items by id.\n\n### Starting New Timer\n\n```python\n# You can get your project pid in toggl.com->Projects->(select your project)\n# and copying the last number of the url\nmyprojectpid = 10959693\ntoggl.startTimeEntry(\"my description\", myprojectpid)\n```\n\n### Stopping Current Timer\n\n```python\ncurrentTimer = currentRunningTimeEntry()\nstopTimeEntry(currentTimer['data']['id'])\n```\n\n### Creating a custom time entry\n\n```python\n# Create a custom entry for today, of a 9 hour duration, starting at 10 AM:\ntoggl.createTimeEntry(hourduration=9, projectname='GoogleDrive', hour=10)\n\n# Or speed up the query process and provide the clien't name:\ntoggl.createTimeEntry(hourduration=9, projectname='GoogleDrive', clientname='Google', hour=10)\n\n# Provide *month* and/or *day* too for specific dates:\ntoggl.createTimeEntry(hourduration=9, projectname='GoogleDrive', clientname='Google', month=1, day=31, hour=10)\n\n# Automate missing time entries!\nfor day in (29, 30, 31):\n\ttoggl.createTimeEntry(hourduration=9, projectname='someproject', day=day, hour=10)\n```\n\n### Automate daily records\n```python\n# toggle_entry.py\nimport datetime\nif datetime.datetime.today().weekday() not in (4, 5):\n\ttoggl.createTimeEntry(hourduration=9, projectname='someproject', hour=10)\n```\n#### Add your daily records as a cron job:\n```shell\n(crontab -l ; echo \"0 22 * * * toggl_entry.py\")| crontab -\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/matthewdowney/TogglPy", "keywords": "api toggl", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "TogglPy", "package_url": "https://pypi.org/project/TogglPy/", "platform": "", "project_url": "https://pypi.org/project/TogglPy/", "project_urls": { "Homepage": "https://github.com/matthewdowney/TogglPy" }, "release_url": "https://pypi.org/project/TogglPy/0.1.1/", "requires_dist": null, "requires_python": "", "summary": "Python library for interacting with the Toggl API.", "version": "0.1.1" }, "last_serial": 4221674, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "51314cf3e226919ca2a28fbff7aa7dcf", "sha256": "9d7da58cfbde91437a12bc5b3a7f22c7275340e88a049ff1373adf300787289c" }, "downloads": -1, "filename": "TogglPy-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "51314cf3e226919ca2a28fbff7aa7dcf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9731, "upload_time": "2018-08-29T13:16:00", "url": "https://files.pythonhosted.org/packages/31/d4/3f198617516f92a5e1098df29f1ec5b82064c78c99c2199fd25e8b87a896/TogglPy-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1c57e669d2772b468f90079dbc2ea87c", "sha256": "52e952ab8641854f7ac0de634475d247d8a7984533f27e655d696f7e5e6cd4cd" }, "downloads": -1, "filename": "TogglPy-0.1.0.tar.gz", "has_sig": false, "md5_digest": "1c57e669d2772b468f90079dbc2ea87c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9077, "upload_time": "2018-08-29T13:16:02", "url": "https://files.pythonhosted.org/packages/2c/8e/af136356d7137f37e5c18285594123e127a86e586b5cb6cdc856e3037d22/TogglPy-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "eab7c5f5794fa843dc1ae4025518990a", "sha256": "5ee5ee22cee416ff268ae00fc74db35e49129712a476e37e656844d4bc046302" }, "downloads": -1, "filename": "TogglPy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "eab7c5f5794fa843dc1ae4025518990a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9814, "upload_time": "2018-08-30T08:13:48", "url": "https://files.pythonhosted.org/packages/94/90/fc518ea6579ca0ceb435082d905891662c894b3839799d0235a05dd3421a/TogglPy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "716bcb71cced0172285dae226f91c6e0", "sha256": "fda2b4d2508a95f5ec3e86128af8ba0006686b69423824bc4967445776f69811" }, "downloads": -1, "filename": "TogglPy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "716bcb71cced0172285dae226f91c6e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9190, "upload_time": "2018-08-30T08:13:50", "url": "https://files.pythonhosted.org/packages/24/82/262a996c9f47c5b4bb2dae38498ad2e326d560d7024f86959d3539cf4179/TogglPy-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eab7c5f5794fa843dc1ae4025518990a", "sha256": "5ee5ee22cee416ff268ae00fc74db35e49129712a476e37e656844d4bc046302" }, "downloads": -1, "filename": "TogglPy-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "eab7c5f5794fa843dc1ae4025518990a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9814, "upload_time": "2018-08-30T08:13:48", "url": "https://files.pythonhosted.org/packages/94/90/fc518ea6579ca0ceb435082d905891662c894b3839799d0235a05dd3421a/TogglPy-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "716bcb71cced0172285dae226f91c6e0", "sha256": "fda2b4d2508a95f5ec3e86128af8ba0006686b69423824bc4967445776f69811" }, "downloads": -1, "filename": "TogglPy-0.1.1.tar.gz", "has_sig": false, "md5_digest": "716bcb71cced0172285dae226f91c6e0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9190, "upload_time": "2018-08-30T08:13:50", "url": "https://files.pythonhosted.org/packages/24/82/262a996c9f47c5b4bb2dae38498ad2e326d560d7024f86959d3539cf4179/TogglPy-0.1.1.tar.gz" } ] }