LiquidPlanner Classic Forum
Key Value for Partial-Day
*Posted on behalf of Antonio Ghiotto. Original post date 2014-05-16*
I try to explain with the code I used in Python 2.7.
For searching an event i used this function:
def events(self):
return json.loads(self.get('/workspaces/' + str(self.workspace_id) + '/
*events*').content)
where 'events' is the key value to obatin the Full-Day Events in
LiquidPlanner.
I have tried to used the key value 'PartialDayEvent', but is not correct:
what is the key value or the correct syntax for reading the Partial-Day
Events?
Posted by LiquidPlanner Support about 5 years ago
API & Python
*Posted on behalf of Tom Idstein. Original posting date 2014-01-24*
Hello,
I am attempting to use the sample API Python Code to access my workspace and make changes. I started by simply trying to use the LP.demo() example script, but I am receiving an error in return.
I am using Python 3.3.3 as well as requests 2.2.
```
SOURCE::
from liquidplanner import LiquidPlanner
import requests #version 2.2.0
import json
import getpass
LiquidPlanner.demo()
RESPONSE::
Add a task? (Y for yes): n
Traceback (most recent call last):
File "C:\Python33\_LEARNING\LP_Test.py", line 6, in <module>
LiquidPlanner.demo()
File "C:\Python33\lib\liquidplanner.py", line 90, in demo
workspace = LP.workspaces()[0]
File "C:\Python33\lib\liquidplanner.py", line 60, in workspaces
return json.loads(self.get('/workspaces').content)
File "C:\Python33\lib\json\__init__.py", line 319, in loads
return _default_decoder.decode(s)
File "C:\Python33\lib\json\decoder.py", line 352, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: can't use a string pattern on a bytes-like object
```
Please let me know how I can resolve this issue, which seems to reside in the json.loads() portion of the code.
Thank you in advance.
Posted by LiquidPlanner Support about 5 years ago