Python API client library for lineworks
Note: This library only supports LINEWORKS API 2.0
Note: This library is not fully comprehensive.
https://github.com/TakuyaSuenaga/pylineworks.
To install run pip install git+https://github.com/TakuyaSuenaga/pylineworks.git
.
Alternatively, you can clone the repo and run pip install path/to/pylineworks
.
To begin, import pylineworks and instantiate the API.
import pylineworks
lw = pylineworks.api(
"Client ID", "Client Secret", "Service Account", "Private Key", "Scope"
)
The pylineworks API is setup so that LINEWORKS API are attributes of the .api()
object. and in turn those apps have attribute representing each endpoint. Each endpoint has a handful of methods available to carry out actions on the endpoint.
>>> bots = lw.bots.bots.all()
>>> print(list(bots))
['Example bot']
>>> for bot in bots:
... print(bot.botName)
Example bot
>>> from pprint import pprint
>>> bot = lw.bots.bots.get(2000001)
>>> pprint(dict(bot))
{
"botId": 2000001,
"botName": "Example bot",
"photoUrl": "https://example.com/favicon.png",
"description": "WorksMobile's A.I. conversation enabled bot",
...
}
>>> bot.description = "Update description"
>>> bot.save()
True
>>>
App | Endpoint | method | HTTP Request |
---|---|---|---|
bots | bots | all | GET /bots |
get | GET /bots/{botId} | ||
create | POST /bots | ||
update | PATCH /bots/{botId} | ||
delete | DELETE /bots/{botId} | ||
users | users | all | GET /users |
get | GET /users/{userId} | ||
boards | boards | all | GET /boards |
get | GET /boards/{boardId} | ||
create | POST /boards | ||
update | PUT /boards/{boardId} | ||
delete | DELETE /boards/{boardId} | ||
calendars | calendars | all | GET /calendars |
get | GET /calendars/{calendarId} | ||
create | POST /calendars | ||
update | PATCH /calendars/{calendarId} | ||
delete | DELETE /calendars/{calendarId} |
I would originally like to do this in editable mode, but it is not yet supported at this time.
pip install -e .
Move into the tests
directory and make a copy of .env_example
named .env
.
This file will hold all of your LINEWORKS parameters.
pip install .[test]
pytest