Code Monkey home page Code Monkey logo

grafana_api's People

Contributors

asalkeld avatar beingnikhilarora avatar cristim avatar dependabot-preview[bot] avatar eric-fontana-bose avatar larsderidder avatar m0nhawk avatar marfx000 avatar max-rocket-internet avatar mbovo avatar mottish avatar ohmrefresh avatar panchorn avatar patsevanton avatar sedan07 avatar svet-b avatar sytten avatar tescalada avatar tharvik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grafana_api's Issues

Incorrect gridPos value caused browser freeze

Creating a Dashboard with custom panels caused UI to be un responsive. I accidentally put incorrect gridPos values which caused the web app to freeze when entering the dashboard.

To Reproduce
Edit the JSON to be like:
some_grid_pos = {"h": 3, "w": 4, "x": 0, "y": 0}
payload["gridPos"] = json.dumps(some_grid_pos)
grafanaclient.dashboard.update_dashboard(dashboard={'dashboard': dashboard})

I know what caused this to happen, it's the extra json.dumps() that added / next to "" in the JSON format but you guys should validate this somehow.

This seems like a major bug

Having trouble with create_new_snapshot() function

First of all I am really thankful for your efforts to create this very useful library.

Now, I am having trouble with create_new_snapshot api, as when I use it, instead of static data, dashboard is keep on showing new data. Now interesting thing is, this is only happening if I am exporting it to snapshot.raintank.io, if I take local snapshot, it works fine.

Here is the code I used:

ref = grafana_api.search.search_dashboards()

for r in ref:
    print(r)
    dashboard1 = grafana_api.dashboard.get_dashboard(r['uid'])
    if r['uid'] == 'gatling':
        res = grafana_api.snapshots.create_new_snapshot(name="run_id_24"+r['title'], dashboard=dashboard1['dashboard'], external=True, key="abcd")
        print(res)
        break

Versions

  • Grafana: [7.2.1]
  • grafana_api: [ 1.0.3]
  • Authentication: [Basic]

So can you guys help me with it.
Here I am attaching one of the snapshot link.

json: cannot unmarshal string into Go value of type dtos.AdminCreateUserForm'}, {'fieldNames': ['Password'], 'classification': 'RequiredError', 'message': 'Required

Hello! Thanks for grafana_api!
I try create user.

from grafana_api.grafana_face import GrafanaFace
grafana_api = GrafanaFace(auth=('admin', 'admin'), host='localhost', port=3000)
user = grafana_api.admin.create_user('User')

error:

grafana_api.grafana_api.GrafanaBadInputError: Bad Input: `[{'classification': 'DeserializationError', 'message': 'json: cannot unmarshal string into Go value of type dtos.AdminCreateUserForm'}, {'fieldNames': ['Password'], 'classification': 'RequiredError', 'message': 'Required'}]`

Try json

user = grafana_api.admin.create_user('{"name":"User","password":"password"}')

same error

folder/dashboard _update functions fail if not exists with overwrite=True

Describe the bug
dashboard.update_dashboard and folder.update_folder state that they will create a dashboard if it doesn't exist. If 'overwrite' is set to True though the actual Grafana API seem to return a 404 which is passed through the grafana_api library as a ClientError. It seems that

To Reproduce
Steps to reproduce the behavior:

  1. Create dashboard and store the json definition
  2. Run call against a new/empty Grafana instance 'GrafanaFaces.folder.update_folder(uid=theUid, title=theTitle, overwrite=True)'
  3. API returns ClientError 404 Dashbord not found

Expected behavior
According to the documentation of the grafana_api, these function calls should create or update, so my expected outcome was that the single call would handle both. Or it should at least return the response as a 404 that I can handle without requiring an exception catch.

Versions

  • Grafana: [7.2.0 ]
  • grafana_api: [ 1.0.3 ]
  • Authentication: Token

Additional context
Add any other context about the problem here.

Organisation should be called Organization

Describe the bug
All the references to Organization are called Organisation in the code, this is not correct.

To Reproduce
Steps to reproduce the behavior:

grafana = grafana_api.GrafanaFace(
    host=GRAFANA_HOST,
    auth=GRAFANA_KEY,
    protocol="https",
    port=443
)

log.debug(grafana.organization)

Expected behavior
Organization API should be returned instead of None

Versions

  • Grafana: [ 6.0.0 ]
  • grafana_api: [ grafana-api==0.5.2 ]
  • Authentication: [Token]

List Annotation wrong parameter name

Grafana API for "Find Annotation" details that the time range parameters are "from" and "to".
this module uses time range parameters "time_from" and "time_to" which are incorrect.

from Grafana example get annotation:
GET /api/annotations?from=1506676478816&to=1507281278816&tags=tag1&tags=tag2&limit=100

this module GET URI:
GET /api/annotations?time_from=1597179600&time_to=1597266000&limit=100

The problem is that if Grafana API doesn't get time range it finds ALL annotations (should have been none from my POV).
So it's easy to miss when testing the API as Grafana will response with annotation it finds but they are not related to the time range.

Not able to establish Connection using pip lib grafana_api

Describe the bug
Hi ,
I have installed the pip install grafana_api, my aim is to retrieve the data from a particular datasource.
I did this
Step 1 : pip3 install grafana_api
Step 2: grafana_api = GrafanaFace(auth=api_key,host='https://XXX/api/datasources')
OR
grafana_api = GrafanaFace(auth=('user_name', pwd), host='https://XXX/api/datasources')
Step 3: Commands works fine but when i do this
grafana_api.datasource.get_datasource_by_id("14")
or grafana_api.datasource.get_datasource_by_id(14)
it fails with below error
**
requests.exceptions.ConnectionError: HTTPConnectionPool(host='https', port=80): Max retries exceeded with url: //XXX/api/datasources/api/datasources/14 (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10b2ece50>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
**

Same works when i'm using request.get on same creds. i.e user name and pwd.

Do, let me know if anything else needed
Thanks
Suprabhat
Additional context
Add any other context about the problem here.

please push release tags

pypi.org has various releases which do not have the appropriate tag in the git repo. Please push your tags!

Checking connection status

Hey,
I think one missing method that should be there for sure is
test_connection()
something that tells you that the connection info you inserted in GrafanaFacade constructor are valid

Thanks in advance

Missing permissions API

Describe the bug
The Status of REST API realization mentioned Dashboard & Folder permissions has been added, but I do not see any permissions-related code in grafana_api api.

To Reproduce
N/A

Expected behavior
Code containing updating/removing permissions for Dashboard & Folders.

Versions

  • Grafana: v6.7.2
  • grafana_api: v1.0.1
  • Authentication: Basic

Additional context
It would be beneficial if you include examples on how to update permissions for Dashboard & Folder.

Error when switching to another organization

What API call you use?
Provide a small example to reproduce the bug.

grafana_api = GrafanaFace(auth=(config["grafana_user"],config["grafana_pass"]),host=config["grafana_url"])
print(grafana_api.organizations.list_organization())
print(grafana_api.organization.get_current_organization())
grafana_api.organizations.switch_organization(organization_id=15)

The first two queries work fine, the last one returns a JSON error.

What is the actual output?
Copy or describe the actual result.

Traceback (most recent call last):
File "provision_api.py", line 19, in
grafana_api.organizations.switch_organization(organization_id=15)
File "/home/yentel/.local/lib/python3.7/site-packages/grafana_api/api/organization.py", line 132, in switch_organization
r = self.api.POST(switch_user_organization)
File "/home/yentel/.local/lib/python3.7/site-packages/grafana_api/grafana_api.py", line 136, in __request_runnner
return r.json()
File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3/dist-packages/simplejson/init.py", line 518, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

What is the expected output?
Something without an error that tells me I've switched to organization with id 15? :-)

create_organization("name") TypeError: string indices must be integers

Hello! Thanks for grafana_api.
How correct create organization ?

grafana_api.organization.create_organization("name")

Output

Traceback (most recent call last):
  File "/home/user/russianpost/service/python-tools-adapter/Grafana/manage-grafana-by-api.py", line 90, in <module>
    grafana_api.organization.create_organization("name")
  File "/usr/local/lib/python3.6/dist-packages/grafana_api/api/organization.py", line 35, in create_organization
    r = self.api.POST(create_orgs_path, json={"name": organization["name"]})
TypeError: string indices must be integers

Process finished with exit code 1

Suggestion for Improvement "get_dashboard_by_name"

Is there a possibilty you could add the following code to the next release please?

def get_dashboard_by_name(self, dashboard_name):
        """

        :param dashboard_name:
        :return:
        """
        get_dashboard_path = "/dashboards/db/%s" % dashboard_name
        r = self.api.GET(get_dashboard_path)
        return r

Can I duplicate a new dashboard from an existing dashboard

What Grafana API endpoint the library is missing?
Describe and link the Grafana API endpoint which are currently missing.

I have an old dashboard, it can be treat as a template dashboard, and now I want to create some dashboard base on it, I only need to modify some query parameters on the new dashboard, can you give me some help? thanks!!!

Giving access denied

What API call you use?
users.find_user(...)
What is the actual output?
Client error 403 permission denied.
What is the expected output?
it should be showing user.

Error when connecting to Grafana

Describe the bug
Traceback when connecting to Grafana

Traceback (most recent call last):
  File "generateGrafanaGraphs.py", line 245, in <module>
    main(sys.argv)
  File "generateGrafanaGraphs.py", line 241, in main
    createGrafanaGRaphs(uplinks)
  File "generateGrafanaGraphs.py", line 107, in createGrafanaGRaphs
    protocol='http')
  File "/usr/local/lib/python2.7/dist-packages/grafana_api/grafana_face.py", line 17, in __init__
    self.teams = Teams(self.api)
  File "/usr/local/lib/python2.7/dist-packages/grafana_api/api/team.py", line 6, in __init__
    super().__init__(api)
TypeError: super() takes at least 1 argument (0 given)

To Reproduce
Steps to reproduce the behavior:

  1. Use python 2.7
  2. Try to connect to Grafana
  3. See error

Fix
Use super(Teams,self)

class Teams(Base):
    def __init__(self, api):
        super(Teams,self).__init__(api)
        self.api = api

Creating annotation with multiple tags results in unmarshal error

Describe the bug

I'd like to create annotations that contain 1..n tags but passing an array or tuple to the add_annotation method fails with an unmarshal error:

Traceback (most recent call last):
  File "<stdin>", line 5, in <module>
  File "/Users/megamorf/.local/share/virtualenvs/webhooks-29Gd7Fk5/lib/python3.7/site-packages/grafana_api/api/annotations.py", line 88, in add_annotation
    r = self.api.POST(annotations_path, json=payload)
  File "/Users/megamorf/.local/share/virtualenvs/webhooks-29Gd7Fk5/lib/python3.7/site-packages/grafana_api/grafana_api.py", line 127, in __request_runnner
    raise GrafanaBadInputError(response)
grafana_api.grafana_api.GrafanaBadInputError: Bad Input: `[{'classification': 'DeserializationError', 'message': 'json: cannot unmarshal array into Go struct field PostAnnotationsCmd.tags of type string'}]`

To Reproduce

Steps to reproduce the behavior:

from grafana_api.grafana_face import GrafanaFace
import time

tags = ['one','two','flex']

grafana_api = GrafanaFace(auth=api_token, host='localhost', port=3000)
grafana_api.annotations.add_annotation(
    time_from=int(time.time()),
    is_region=False,
    tags=tags,
    text="Job #345"
)

Expected behavior
Creating an annotation with multiple tags works when I do it without your code:

import requests
import json
import time
from datetime import datetime

example_annotation = {
    "time": int(time.time()),
    "tags": ["one", "two", "flex"],
    "text": str(datetime.now()),
}

def add_annotation_raw(annotation):
    resp = requests.post('http://localhost:3000/api/annotations',
        json=annotation,
        headers = {'Authorization': 'Bearer <api_key>'}
    )
    
    resp.raise_for_status()
    print('Created annotation. ID: {}'.format(resp.json()["id"]))
>>> add_annotation_raw(example_annotation)
Created annotation. ID: 9


{'alertId': 0,
  'alertName': '',
  'avatarUrl': '',
  'created': 1577398963875,
  'dashboardId': 0,
  'data': {},
  'email': '',
  'id': 9,
  'login': '',
  'newState': '',
  'panelId': 0,
  'prevState': '',
  'tags': ['one', 'two', 'flex'],
  'text': '2019-12-26 23:11:30.178468',
  'time': 1577398290,
  'timeEnd': 1577398290,
  'updated': 1577398963875,
  'userId': 0},

Versions

  • Grafana: version=6.5.1 commit=1763a0f
  • grafana_api: 0.9.2
  • Authentication: Token

Missing timeouts

Describe the bug
The requests never timeout, this is not a good idea in general

Expected behavior
The user should be able to set one and there should be a default (maybe 10s)

grafana_api does not pass errors to caller anymore

Describe the bug

in grafana_api.py, line 114:
            except Exception as error:
                print('Caught this error: ' + repr(error))

you are catching all exceptions you were throwing before - with the result, that all issues are hidden to the code that actually uses grafana_api. This is pretty much broken.

According to the commit, this is supposed to fix unit tests. If this fixes unit tests, they are also broken...

Expected would be that the errors are being raised.

API token, Unauthorized?

Describe the bug
Authentication by api token is not working

To Reproduce
grafana_api = GrafanaFace(auth='abcdefg', host='grafana.XXX.com')
grafana_api.folder.get_all_folders()... just any kind of API call

RESULT below,

grafana_api.grafana_api.GrafanaUnauthorizedError: Unauthorized

Expected behavior
I thought that since these kinds of call is not about admin API api token based authentication must work. So I created API key, which is not expired, and gave the role admin. But it is still not working. Also, our organization uses google OAuth for authentication. So using basic auth is not applicable here.

Versions

  • Grafana: [ v7.1.5 ]
  • grafana_api: [ 1.0.3 ]
  • Authentication: [Token]

Additional context
Add any other context about the problem here.

Documentation links point to page that returns 404

Describe the bug
Hi, trying to find the documentation. The link in github homepage points to https://m0nhawk.github.io/grafana_api/ same in the documentation site. Would be great if it could be updated in github page, so its easy to find documentation

To Reproduce
Steps to reproduce the behavior:

  1. Visit https://github.com/m0nhawk/grafana_api in browser. Press link in top-right corner under "About". It points to https://m0nhawk.github.io/grafana_api/
  2. Alternately the links here are broken as well: https://anaconda.org/m0nhawk/grafana_api

Expected behavior
Link points to page without 404

Thanks

Updating dashboards will cause them to move to the "General" folder

Dear Andrew,

first things first: Thank you so much for conceiving and maintaining this library. We are using it in grafana-wtf, which you also might like.

Now, I just found @vinnyfuria reported about Grafana Dashboards being moved to the "General" folder when updating them within grafana-toolbox/grafana-wtf#5.

Have you also been able to observe this behavior? Maybe it is only happening with Grafana 7? Sorry that I am currently not able to verify this as I don't have access to any Grafana 7 instance yet. I know I could rig up a Docker container for that, but nevertheless I wanted to report this to you in the hope you will be quicker than me.

Thanks already for looking into this and with kind regards,
Andreas.

update_dashboard() failing.

Describe the bug
Using update_dashboard method fails.

To Reproduce
Steps to reproduce the behavior:

  1. Create GrafanaFace object.
  2. Call api.dashboard.update_dashboard()
  3. Pass in a JSON dashboard example from https://grafana.com/docs/grafana/latest/http_api/dashboard/#create-update-dashboard.

Expected behavior
The dashboard is created.

Versions

  • Grafana: [ 6.4.4]
  • grafana_api: [/dashboards/db ]
  • Authentication: [Token]

Additional context
My code. Works with normal requests library.

import grafana_api
import requests

with open("test.json") as json_data:
    # Using template from: https://grafana.com/docs/grafana/latest/http_api/dashboard/#create-update-dashboard
    test = json_data.read()

# Fails.
api = grafana_api.GrafanaFace(auth="my token", host="some grafana host")
# This method works so authentication is fine.
print(api.dashboard.get_home_dashboard())
print(api.dashboard.update_dashboard(test))

# Works all good with requests.
resp = requests.post("https://grafanahost.com/api/dashboards/db", headers={"Accept": "application/json", "Content-Type": "application/json", "Authorization": "Bearer token here"}, data=test)
print(resp.status_code)
print(resp.text)
print(resp.json())

Full traceback:

Traceback (most recent call last):
  File ".\test.py", line 12, in <module>
    print(api.dashboard.update_dashboard(str(test)))
  File "C:\Users\\.virtualenvs\lib\site-packages\grafana_api\api\dashboard.py", line 26, in update_dashboard
    r = self.api.POST(put_dashboard_path, json=dashboard)
  File "C:\Users\.virtualenvs\\lib\site-packages\grafana_api\grafana_api.py", line 111, in __request_runnner
    return r.json()
  File "C:\Users\\lib\site-packages\requests\models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "c:\python37\Lib\json\__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "c:\python37\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "c:\python37\Lib\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)

update_folder raise TypeError

Describe the bug
Method update_folder of folder class raises TypeError('not all arguments converted during string formatting')

To Reproduce
Steps to reproduce the behavior:

  1. Create an instance: g = GrafanaFace(...)
  2. Run call g.folder.update_folder(uid, title)
  3. See TypeError('not all arguments converted during string formatting')

Expected behavior
Method update_folder working as expected

Versions

  • Grafana: any
  • grafana_api: >= 0.7.3
  • Authentication: Basic

Module import fails for v0.3.1

Firstly, thanks for a very useful package! The new refactoring of the module structure also looks like a good step forward.

However, the module bundled in the latest package (v0.3.1) cannot actually be imported:

>>> import grafana_api
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/grafana_api-0.3.1-py3.6.egg/grafana_api/__init__.py", line 1, in <module>
    from .grafana_face import GrafanaFace
  File "/usr/local/lib/python3.6/site-packages/grafana_api-0.3.1-py3.6.egg/grafana_api/grafana_face.py", line 2, in <module>
    from .api import Base
ModuleNotFoundError: No module named 'grafana_api.api'

The grafana_api.api submodule needs to be explicitly included in setup.py in order for it to be included in the package. I've gone ahead and created a PR which I believe addressed this: #4.

Timeout for snapshot

Is there any "timeout" option , when creating snapshot using HTTP API, not only via grafana GUI. Because when there are complex queries to execute on background, query is failing without timeout option.

Thanks in advance.

folder.create_folder() doesn't create folder, but returns the list of existing folder

Describe the bug
folder.create_folder() doesn't create folders. It only returns the list of existing folders.

To Reproduce
Steps to reproduce the behavior:

secret = "YOUR_SECRET_HERE"
url = "YOUR_URL_HERE"
from grafana_api.grafana_face import GrafanaFace as GF
gf = GF(auth=secret, host=url)
res = gf.folder.create_folder('NEW_TITLE')
# `res` contains only existing folders, no new folder is created 

Expected behavior
Expected new folder is created.

Versions

  • Grafana: v7.0.3 (00ee734baf)
  • grafana_api: 1.0.2
  • Authentication: Token

`Annotations.add_annotation` needs to be updated with current Grafana API endpoint

Describe the bug
Currently, the add_annotation method supports

time
timeEnd
isRegion
tags
text

parameters, while the current API lists

dashboardId
panelId
time
timeEnd
tags
text

allowing both global, region and annotations linked to a panel (which was what I'm after, btw).

Expected behavior
Support the full set of functions supported by Grafana.

Versions

  • Grafana: Grafana v6.6 (current)
  • grafana_api: grafana-api==1.0.0
  • Authentication: Irrelevant

edit - typos

The installation via pip seems to be broken

Describe the bug
pip install -U grafana_api
Collecting grafana_api
Downloading grafana_api-1.0.0.tar.gz (17 kB)
ERROR: Command errored out with exit status 1:
command: /home/vagrant/testenvironment/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-sszj54t9/grafana-api/setup.py'"'"'; file='"'"'/tmp/pip-install-sszj54t9/grafana-api/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-sszj54t9/grafana-api/pip-egg-info
cwd: /tmp/pip-install-sszj54t9/grafana-api/
Complete output (19 lines):
fatal: Not a git repository (or any of the parent directories): .git
Traceback (most recent call last):
File "/tmp/pip-install-sszj54t9/grafana-api/setup.py", line 8, in get_version
["git", "describe", "--tags", "--abbrev=0", "--match=[0-9]"]
File "/usr/lib64/python3.6/subprocess.py", line 356, in check_output
**kwargs).stdout
File "/usr/lib64/python3.6/subprocess.py", line 438, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', 'describe', '--tags', '--abbrev=0', '--match=[0-9]
']' returned non-zero exit status 128.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-sszj54t9/grafana-api/setup.py", line 24, in <module>
    version=get_version(),
  File "/tmp/pip-install-sszj54t9/grafana-api/setup.py", line 13, in get_version
    "The version number cannot be extracted from git tag in this source "
RuntimeError: The version number cannot be extracted from git tag in this source distribution; please either download the source from PyPI, or check out from GitHub and make sure that the git CLI is available.
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

To Reproduce
Steps to reproduce the behavior:
pip install -U grafana_api

Expected behavior
should have been installed

  • grafana_api: [ 1.0.0]

Connection timeout

Describe the bug
Hello. When I try to update a dashboard which contains more than 40 plots using the following code:
grafana_api.dashboard.update_dashboard(dashboard={'dashboard': dashboard_json['dashboard'], 'folderid': dashboard_json['meta']['folderId'], 'overwrite': True})
I have the following issue:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1065, in _send_output
    self.send(chunk)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 987, in send
    self.sock.sendall(data)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1034, in sendall
    v = self.send(byte_view[count:])
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1003, in send
    return self._sslobj.write(data)
socket.timeout: The write operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 449, in send
    timeout=timeout
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 725, in urlopen
    method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
  File "/usr/local/lib/python3.7/site-packages/urllib3/util/retry.py", line 403, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 734, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 677, in urlopen
    chunked=chunked,
  File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 392, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1252, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1298, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1247, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1065, in _send_output
    self.send(chunk)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 987, in send
    self.sock.sendall(data)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1034, in sendall
    v = self.send(byte_view[count:])
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1003, in send
    return self._sslobj.write(data)
urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/requests/adapters.py", line 498, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', timeout('The write operation timed out'))

To Reproduce
Steps to reproduce the behavior:

  1. Update dashboard with a large number of plots
  2. See error

Expected behavior
I would like to get an updated dashboard.

Versions

  • Grafana: 6.7.3
  • grafana_api: 1.02
  • Authentication: Token

Additional context

Error with grafana_api.search.search_dashboards

Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1741, in
main()
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1735, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1135, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/Users/ali/Dropbox/WORK/Workspace/grafana-dash/list-dash.py", line 6, in
grafana_api.search.search_dashboards(dashboard_ids=9)
File "/Users/ali/Dropbox/WORK/Workspace/venv/lib/python3.7/site-packages/grafana_api/api/search.py", line 57, in search_dashboards
r = self.api.GET(list_dashboard_path)
File "/Users/ali/Dropbox/WORK/Workspace/venv/lib/python3.7/site-packages/grafana_api/grafana_api.py", line 99, in __request_runnner
"Client Error {0}: {1}".format(r.status_code, r.json()['message'])
File "/Users/ali/Dropbox/WORK/Workspace/venv/lib/python3.7/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/3.7.2/Frameworks/Python.framework/Versions/3.7/lib/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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.