Comments (6)
All the methods in the library is expecting JSON (dictionaries in Python) values as an input.
So, something like this will work:
with open("test.json") as json_data:
test = json_data.read()
test = json.loads(test)
print(api.dashboard.update_dashboard(test))
Feel free to re-open this issue or create a new one for other questions.
from grafana_api.
Hey, so I just started using the API and I'm running to the same issue now, except I am using a Python dict to represent the dashboard, but I'm still getting the same error.
I even tried with one of the test case dicts in test_dashboard.py
to be sure it wasn't a malformed json, and that didn't work either.
from grafana_api.
@m0nhawk for context:
my_db = {'id': None, 'uid': None, 'title': 'hithere', 'tags': ['templated'], 'timezone': 'browser', 'schemaVersion': 16, 'version': 0}
grafana_api = GrafanaFace(auth='...', host='...')
# get operations work fine. I tested folders.get_all_folders(), for example, both with improper auth and proper auth to make sure it was working as expected.
grafana_api.dashboard.update_dashboard({'dashboard': my_db, 'folderId': 0, 'overwrite': True})
Output:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File ".../site-packages/grafana_api/api/dashboard.py", line 26, in update_dashboard
r = self.api.POST(put_dashboard_path, json=dashboard)
File ".../site-packages/grafana_api/grafana_api.py", line 136, in __request_runnner
return r.json()
File ".../site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File ".../python3.7/json/__init__.py", line 348, in loads
return _default_decoder.decode(s)
File ".../python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File ".../python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
from grafana_api.
Grafana version v6.6.1
from grafana_api.
It looks like the exception is happening on the response being converted to json.
from grafana_api.
Never mind, after debugging I found out the url was automatically resolving to the wrong protocol. Setting it fixed the whole thing!
from grafana_api.
Related Issues (20)
- Not able to establish Connection using pip lib grafana_api HOT 4
- Giving access denied HOT 3
- Missing permissions API HOT 1
- Support for notification channels
- Connection timeout
- folder.create_folder() doesn't create folder, but returns the list of existing folder HOT 2
- List Annotation wrong parameter name HOT 2
- json: cannot unmarshal string into Go value of type dtos.AdminCreateUserForm'}, {'fieldNames': ['Password'], 'classification': 'RequiredError', 'message': 'Required HOT 4
- Error when switching to another organization HOT 3
- create_organization("name") TypeError: string indices must be integers HOT 1
- folder/dashboard _update functions fail if not exists with overwrite=True HOT 1
- API token, Unauthorized? HOT 2
- Updating dashboards will cause them to move to the "General" folder HOT 6
- Having trouble with create_new_snapshot() function HOT 1
- Documentation links point to page that returns 404
- how to get the json of home dashboard ?
- Future maintenance of this repository and package HOT 4
- Can I duplicate a new dashboard from an existing dashboard HOT 2
- Suggestion for Improvement "get_dashboard_by_name" HOT 1
- Checking connection status HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grafana_api.