code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def test_get_headers(url, body, expected_content_type): """Test header extraction and content type detection.""" parsed_url = apprise_parse_url(url) headers = _get_headers(parsed_url, body) if expected_content_type: assert headers.get("Content-Type") == expected_content_type
Test header extraction and content type detection.
test_get_headers
python
dgtlmoon/changedetection.io
changedetectionio/tests/apprise/test_apprise_custom_api_call.py
https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/tests/apprise/test_apprise_custom_api_call.py
Apache-2.0
def test_get_params(url, expected_params): """Test parameter extraction with URL encoding and exclusion logic.""" parsed_url = apprise_parse_url(url) params = _get_params(parsed_url) assert dict(params) == expected_params
Test parameter extraction with URL encoding and exclusion logic.
test_get_params
python
dgtlmoon/changedetection.io
changedetectionio/tests/apprise/test_apprise_custom_api_call.py
https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/tests/apprise/test_apprise_custom_api_call.py
Apache-2.0
def test_apprise_custom_api_call_success(mock_request, url, schema, method): """Test successful API calls with different HTTP methods and schemas.""" mock_request.return_value.raise_for_status.return_value = None meta = {"url": url, "schema": schema} result = apprise_http_custom_handler( body="...
Test successful API calls with different HTTP methods and schemas.
test_apprise_custom_api_call_success
python
dgtlmoon/changedetection.io
changedetectionio/tests/apprise/test_apprise_custom_api_call.py
https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/tests/apprise/test_apprise_custom_api_call.py
Apache-2.0
def test_invalid_url_parsing(): """Test handling of invalid URL parsing.""" meta = {"url": "invalid://url", "schema": "invalid"} result = apprise_http_custom_handler( body="test", title="Invalid URL", notify_type="info", meta=meta ) assert result is False
Test handling of invalid URL parsing.
test_invalid_url_parsing
python
dgtlmoon/changedetection.io
changedetectionio/tests/apprise/test_apprise_custom_api_call.py
https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/tests/apprise/test_apprise_custom_api_call.py
Apache-2.0
def test_https_method_conversion( mock_request, input_schema, expected_method ): """Validate that methods ending with 's' use HTTPS and correct HTTP method.""" mock_request.return_value.raise_for_status.return_value = None url = f"{input_schema}://localhost:9999" result = apprise_http_custom_handl...
Validate that methods ending with 's' use HTTPS and correct HTTP method.
test_https_method_conversion
python
dgtlmoon/changedetection.io
changedetectionio/tests/apprise/test_apprise_custom_api_call.py
https://github.com/dgtlmoon/changedetection.io/blob/master/changedetectionio/tests/apprise/test_apprise_custom_api_call.py
Apache-2.0
def search_satellite_data(coordinates, cloud_cover_lt, product="landsat"): """ coordinates: bounding box's coordinates cloud_cover_lt: maximum cloud cover product: landsat, sentinel """ if product == "landsat": product = "landsat-8-l1-c1" elif product == "sentinel": product =...
coordinates: bounding box's coordinates cloud_cover_lt: maximum cloud cover product: landsat, sentinel
search_satellite_data
python
plant99/felicette
felicette/sat_downloader.py
https://github.com/plant99/felicette/blob/master/felicette/sat_downloader.py
MIT
def display_file(file_name): """ Open given file with default user program. """ if sys.platform.startswith("linux"): os.system("xdg-open %s" % file_name) elif sys.platform.startswith("darwin"): os.system("open %s" % file_name)
Open given file with default user program.
display_file
python
plant99/felicette
felicette/utils/sys_utils.py
https://github.com/plant99/felicette/blob/master/felicette/utils/sys_utils.py
MIT
def main(host='localhost', port=8086): """Instantiate the connection to the InfluxDB client.""" user = 'root' password = 'root' dbname = 'demo' protocol = 'line' client = DataFrameClient(host, port, user, password, dbname) print("Create pandas DataFrame") df = pd.DataFrame(data=list(ra...
Instantiate the connection to the InfluxDB client.
main
python
influxdata/influxdb-python
examples/tutorial_pandas.py
https://github.com/influxdata/influxdb-python/blob/master/examples/tutorial_pandas.py
MIT
def main(host='localhost', port=8086): """Define function to generate the sin wave.""" now = datetime.datetime.today() points = [] for angle in range(0, 360): y = 10 + math.sin(math.radians(angle)) * 10 point = { "measurement": 'foobar', "time": int(now.strftime...
Define function to generate the sin wave.
main
python
influxdata/influxdb-python
examples/tutorial_sine_wave.py
https://github.com/influxdata/influxdb-python/blob/master/examples/tutorial_sine_wave.py
MIT
def loads(s): """Generate a sequence of JSON values from a string.""" _decoder = json.JSONDecoder() while s: s = s.strip() obj, pos = _decoder.raw_decode(s) if not pos: raise ValueError('no JSON object found at %i' % pos) yield obj s = s[pos:]
Generate a sequence of JSON values from a string.
loads
python
influxdata/influxdb-python
influxdb/chunked_json.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/chunked_json.py
MIT
def from_dsn(cls, dsn, **kwargs): r"""Generate an instance of InfluxDBClient from given data source name. Return an instance of :class:`~.InfluxDBClient` from the provided data source name. Supported schemes are "influxdb", "https+influxdb" and "udp+influxdb". Parameters for the :class:...
Generate an instance of InfluxDBClient from given data source name. Return an instance of :class:`~.InfluxDBClient` from the provided data source name. Supported schemes are "influxdb", "https+influxdb" and "udp+influxdb". Parameters for the :class:`~.InfluxDBClient` constructor may als...
from_dsn
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def switch_user(self, username, password): """Change the client's username. :param username: the username to switch to :type username: str :param password: the password for the username :type password: str """ self._username = username self._password = pa...
Change the client's username. :param username: the username to switch to :type username: str :param password: the password for the username :type password: str
switch_user
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def request(self, url, method='GET', params=None, data=None, stream=False, expected_response_code=200, headers=None): """Make a HTTP request to the InfluxDB API. :param url: the path of the HTTP request, e.g. write, query, etc. :type url: str :param method: the HTTP meth...
Make a HTTP request to the InfluxDB API. :param url: the path of the HTTP request, e.g. write, query, etc. :type url: str :param method: the HTTP method for the request, defaults to GET :type method: str :param params: additional parameters for the request, defaults to None ...
request
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def write(self, data, params=None, expected_response_code=204, protocol='json'): """Write data to InfluxDB. :param data: the data to be written :type data: (if protocol is 'json') dict (if protocol is 'line') sequence of line protocol strings ...
Write data to InfluxDB. :param data: the data to be written :type data: (if protocol is 'json') dict (if protocol is 'line') sequence of line protocol strings or single string :param params: additional parameters for the request, defaults to None ...
write
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def query(self, query, params=None, bind_params=None, epoch=None, expected_response_code=200, database=None, raise_errors=True, chunked=False, chunk_size=0, method="GET"): ...
Send a query to InfluxDB. .. danger:: In order to avoid injection vulnerabilities (similar to `SQL injection <https://www.owasp.org/index.php/SQL_Injection>`_ vulnerabilities), do not directly include untrusted data into the ``query`` parameter, use ``bind_params...
query
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def write_points(self, points, time_precision=None, database=None, retention_policy=None, tags=None, batch_size=None, protocol='json', consistency=None ...
Write to multiple time series names. :param points: the list of points to be written in the database :type points: list of dictionaries, each dictionary represents a point :type points: (if protocol is 'json') list of dicts, where each dict represents a point. ...
write_points
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def ping(self): """Check connectivity to InfluxDB. :returns: The version of the InfluxDB the client is connected to """ response = self.request( url="ping", method='GET', expected_response_code=204 ) return response.headers['X-Influxd...
Check connectivity to InfluxDB. :returns: The version of the InfluxDB the client is connected to
ping
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def get_list_series(self, database=None, measurement=None, tags=None): """ Query SHOW SERIES returns the distinct series in your database. FROM and WHERE clauses are optional. :param measurement: Show all series from a measurement :type id: string :param tags: Show all ...
Query SHOW SERIES returns the distinct series in your database. FROM and WHERE clauses are optional. :param measurement: Show all series from a measurement :type id: string :param tags: Show all series that match given tags :type id: dict :param database: the d...
get_list_series
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def create_retention_policy(self, name, duration, replication, database=None, default=False, shard_duration="0s"): """Create a retention policy for a database. :param name: the name of the new retention policy :type name: str ...
Create a retention policy for a database. :param name: the name of the new retention policy :type name: str :param duration: the duration of the new retention policy. Durations such as 1h, 90m, 12h, 7d, and 4w, are all supported and mean 1 hour, 90 minutes, 12 hours, 7 d...
create_retention_policy
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def alter_retention_policy(self, name, database=None, duration=None, replication=None, default=None, shard_duration=None): """Modify an existing retention policy for a database. :param name: the name of the retention policy to modify ...
Modify an existing retention policy for a database. :param name: the name of the retention policy to modify :type name: str :param database: the database for which the retention policy is modified. Defaults to current client's database :type database: str :param dura...
alter_retention_policy
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def drop_retention_policy(self, name, database=None): """Drop an existing retention policy for a database. :param name: the name of the retention policy to drop :type name: str :param database: the database for which the retention policy is dropped. Defaults to current clien...
Drop an existing retention policy for a database. :param name: the name of the retention policy to drop :type name: str :param database: the database for which the retention policy is dropped. Defaults to current client's database :type database: str
drop_retention_policy
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def get_list_retention_policies(self, database=None): """Get the list of retention policies for a database. :param database: the name of the database, defaults to the client's current database :type database: str :returns: all retention policies for the database :rty...
Get the list of retention policies for a database. :param database: the name of the database, defaults to the client's current database :type database: str :returns: all retention policies for the database :rtype: list of dictionaries :Example: :: ...
get_list_retention_policies
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def create_user(self, username, password, admin=False): """Create a new user in InfluxDB. :param username: the new username to create :type username: str :param password: the password for the new user :type password: str :param admin: whether the user should have cluster...
Create a new user in InfluxDB. :param username: the new username to create :type username: str :param password: the password for the new user :type password: str :param admin: whether the user should have cluster administration privileges or not :type admin: ...
create_user
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def set_user_password(self, username, password): """Change the password of an existing user. :param username: the username who's password is being changed :type username: str :param password: the new password for the user :type password: str """ text = "SET PASSW...
Change the password of an existing user. :param username: the username who's password is being changed :type username: str :param password: the new password for the user :type password: str
set_user_password
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def delete_series(self, database=None, measurement=None, tags=None): """Delete series from a database. Series must be filtered by either measurement and tags. This method cannot be used to delete all series, use `drop_database` instead. :param database: the database from which ...
Delete series from a database. Series must be filtered by either measurement and tags. This method cannot be used to delete all series, use `drop_database` instead. :param database: the database from which the series should be deleted, defaults to client's current database ...
delete_series
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def grant_privilege(self, privilege, database, username): """Grant a privilege on a database to a user. :param privilege: the privilege to grant, one of 'read', 'write' or 'all'. The string is case-insensitive :type privilege: str :param database: the database to grant the p...
Grant a privilege on a database to a user. :param privilege: the privilege to grant, one of 'read', 'write' or 'all'. The string is case-insensitive :type privilege: str :param database: the database to grant the privilege on :type database: str :param username: the ...
grant_privilege
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def revoke_privilege(self, privilege, database, username): """Revoke a privilege on a database from a user. :param privilege: the privilege to revoke, one of 'read', 'write' or 'all'. The string is case-insensitive :type privilege: str :param database: the database to revoke...
Revoke a privilege on a database from a user. :param privilege: the privilege to revoke, one of 'read', 'write' or 'all'. The string is case-insensitive :type privilege: str :param database: the database to revoke the privilege on :type database: str :param username:...
revoke_privilege
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def get_list_continuous_queries(self): """Get the list of continuous queries in InfluxDB. :return: all CQs in InfluxDB :rtype: list of dictionaries :Example: :: >> cqs = client.get_list_cqs() >> cqs [ { u...
Get the list of continuous queries in InfluxDB. :return: all CQs in InfluxDB :rtype: list of dictionaries :Example: :: >> cqs = client.get_list_cqs() >> cqs [ { u'db1': [] }, { ...
get_list_continuous_queries
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def create_continuous_query(self, name, select, database=None, resample_opts=None): r"""Create a continuous query for a database. :param name: the name of continuous query to create :type name: str :param select: select statement for the continuous query ...
Create a continuous query for a database. :param name: the name of continuous query to create :type name: str :param select: select statement for the continuous query :type select: str :param database: the database for which the continuous query is created. Defaults ...
create_continuous_query
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def drop_continuous_query(self, name, database=None): """Drop an existing continuous query for a database. :param name: the name of continuous query to drop :type name: str :param database: the database for which the continuous query is dropped. Defaults to current client's ...
Drop an existing continuous query for a database. :param name: the name of continuous query to drop :type name: str :param database: the database for which the continuous query is dropped. Defaults to current client's database :type database: str
drop_continuous_query
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def send_packet(self, packet, protocol='json', time_precision=None): """Send an UDP packet. :param packet: the packet to be sent :type packet: (if protocol is 'json') dict (if protocol is 'line') list of line protocol strings :param protocol: protocol of input data...
Send an UDP packet. :param packet: the packet to be sent :type packet: (if protocol is 'json') dict (if protocol is 'line') list of line protocol strings :param protocol: protocol of input data, either 'json' or 'line' :type protocol: str :param time_precis...
send_packet
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def _parse_dsn(dsn): """Parse data source name. This is a helper function to split the data source name provided in the from_dsn classmethod """ conn_params = urlparse(dsn) init_args = {} scheme_info = conn_params.scheme.split('+') if len(scheme_info) == 1: scheme = scheme_info[...
Parse data source name. This is a helper function to split the data source name provided in the from_dsn classmethod
_parse_dsn
python
influxdata/influxdb-python
influxdb/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/client.py
MIT
def __new__(cls, *args, **kwargs): """Initialize class attributes for subsequent constructor calls. :note: *args and **kwargs are not explicitly used in this function, but needed for Python 2 compatibility. """ if not cls.__initialized__: cls.__initialized__ = True ...
Initialize class attributes for subsequent constructor calls. :note: *args and **kwargs are not explicitly used in this function, but needed for Python 2 compatibility.
__new__
python
influxdata/influxdb-python
influxdb/helper.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/helper.py
MIT
def __init__(self, **kw): """Call to constructor creates a new data point. :note: Data points written when `bulk_size` is reached per Helper. :warning: Data points are *immutable* (`namedtuples`). """ cls = self.__class__ timestamp = kw.pop('time', self._current_timestam...
Call to constructor creates a new data point. :note: Data points written when `bulk_size` is reached per Helper. :warning: Data points are *immutable* (`namedtuples`).
__init__
python
influxdata/influxdb-python
influxdb/helper.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/helper.py
MIT
def _json_body_(cls): """Return the JSON body of given datapoints. :return: JSON body of these datapoints. """ json = [] if not cls.__initialized__: cls._reset_() for series_name, data in six.iteritems(cls._datapoints): for point in data: ...
Return the JSON body of given datapoints. :return: JSON body of these datapoints.
_json_body_
python
influxdata/influxdb-python
influxdb/helper.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/helper.py
MIT
def _get_unicode(data, force=False): """Try to return a text aka unicode object from the given data.""" if isinstance(data, binary_type): return data.decode('utf-8') if data is None: return '' if force: if PY2: return unicode(data) return str(data) retu...
Try to return a text aka unicode object from the given data.
_get_unicode
python
influxdata/influxdb-python
influxdb/line_protocol.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/line_protocol.py
MIT
def make_line(measurement, tags=None, fields=None, time=None, precision=None): """Extract the actual point from a given measurement line.""" tags = tags or {} fields = fields or {} line = _escape_tag(_get_unicode(measurement)) # tags should be sorted client-side to take load off server tag_lis...
Extract the actual point from a given measurement line.
make_line
python
influxdata/influxdb-python
influxdb/line_protocol.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/line_protocol.py
MIT
def make_lines(data, precision=None): """Extract points from given dict. Extracts the points from the given dict and returns a Unicode string matching the line protocol introduced in InfluxDB 0.9.0. """ lines = [] static_tags = data.get('tags') for point in data['points']: if static...
Extract points from given dict. Extracts the points from the given dict and returns a Unicode string matching the line protocol introduced in InfluxDB 0.9.0.
make_lines
python
influxdata/influxdb-python
influxdb/line_protocol.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/line_protocol.py
MIT
def __getitem__(self, key): """Retrieve the series name or specific set based on key. :param key: Either a series name, or a tags_dict, or a 2-tuple(series_name, tags_dict). If the series name is None (or not given) then any serie matching the...
Retrieve the series name or specific set based on key. :param key: Either a series name, or a tags_dict, or a 2-tuple(series_name, tags_dict). If the series name is None (or not given) then any serie matching the eventual given tags will be given its ...
__getitem__
python
influxdata/influxdb-python
influxdb/resultset.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/resultset.py
MIT
def get_points(self, measurement=None, tags=None): """Return a generator for all the points that match the given filters. :param measurement: The measurement name :type measurement: str :param tags: Tags to look for :type tags: dict :return: Points generator ""...
Return a generator for all the points that match the given filters. :param measurement: The measurement name :type measurement: str :param tags: Tags to look for :type tags: dict :return: Points generator
get_points
python
influxdata/influxdb-python
influxdb/resultset.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/resultset.py
MIT
def _tag_matches(tags, filter): """Check if all key/values in filter match in tags.""" for tag_name, tag_value in filter.items(): # using _sentinel as I'm not sure that "None" # could be used, because it could be a valid # series_tags value : when a series has no such...
Check if all key/values in filter match in tags.
_tag_matches
python
influxdata/influxdb-python
influxdb/resultset.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/resultset.py
MIT
def keys(self): """Return the list of keys in the ResultSet. :return: List of keys. Keys are tuples (series_name, tags) """ keys = [] for series in self._get_series(): keys.append( (series.get('measurement', series.get('nam...
Return the list of keys in the ResultSet. :return: List of keys. Keys are tuples (series_name, tags)
keys
python
influxdata/influxdb-python
influxdb/resultset.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/resultset.py
MIT
def items(self): """Return the set of items from the ResultSet. :return: List of tuples, (key, generator) """ items = [] for series in self._get_series(): series_key = (series.get('measurement', series.get('name', 'results')), ...
Return the set of items from the ResultSet. :return: List of tuples, (key, generator)
items
python
influxdata/influxdb-python
influxdb/resultset.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/resultset.py
MIT
def _get_points_for_series(self, series): """Return generator of dict from columns and values of a series. :param series: One series :return: Generator of dicts """ for point in series.get('values', []): yield self.point_from_cols_vals( series['column...
Return generator of dict from columns and values of a series. :param series: One series :return: Generator of dicts
_get_points_for_series
python
influxdata/influxdb-python
influxdb/resultset.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/resultset.py
MIT
def point_from_cols_vals(cols, vals): """Create a dict from columns and values lists. :param cols: List of columns :param vals: List of values :return: Dict where keys are columns. """ point = {} for col_index, col_name in enumerate(cols): point[col_n...
Create a dict from columns and values lists. :param cols: List of columns :param vals: List of values :return: Dict where keys are columns.
point_from_cols_vals
python
influxdata/influxdb-python
influxdb/resultset.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/resultset.py
MIT
def write_points(self, dataframe, measurement, tags=None, tag_columns=None, field_columns=None, time_precision=None, database=None, retention_policy=Non...
Write to multiple time series names. :param dataframe: data points in a DataFrame :param measurement: name of measurement :param tags: dictionary of tags, with string key-values :param tag_columns: [Optional, default None] List of data tag names :param field_columns: [Options, d...
write_points
python
influxdata/influxdb-python
influxdb/_dataframe_client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/_dataframe_client.py
MIT
def query(self, query, params=None, bind_params=None, epoch=None, expected_response_code=200, database=None, raise_errors=True, chunked=False, chunk_size=0, method="GET", ...
Query data into a DataFrame. .. danger:: In order to avoid injection vulnerabilities (similar to `SQL injection <https://www.owasp.org/index.php/SQL_Injection>`_ vulnerabilities), do not directly include untrusted data into the ``query`` parameter, use `...
query
python
influxdata/influxdb-python
influxdb/_dataframe_client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/_dataframe_client.py
MIT
def loads(s): """Generate a sequence of JSON values from a string.""" _decoder = json.JSONDecoder() while s: s = s.strip() obj, pos = _decoder.raw_decode(s) if not pos: raise ValueError('no JSON object found at %i' % pos) yield obj s = s[pos:]
Generate a sequence of JSON values from a string.
loads
python
influxdata/influxdb-python
influxdb/influxdb08/chunked_json.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/chunked_json.py
MIT
def from_dsn(dsn, **kwargs): r"""Return an instaance of InfluxDBClient from given data source name. Returns an instance of InfluxDBClient from the provided data source name. Supported schemes are "influxdb", "https+influxdb", "udp+influxdb". Parameters for the InfluxDBClient constructor...
Return an instaance of InfluxDBClient from given data source name. Returns an instance of InfluxDBClient from the provided data source name. Supported schemes are "influxdb", "https+influxdb", "udp+influxdb". Parameters for the InfluxDBClient constructor may be also be passed to this fu...
from_dsn
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def switch_user(self, username, password): """Change client username. :param username: the new username to switch to :type username: string :param password: the new password to switch to :type password: string """ self._username = username self._password ...
Change client username. :param username: the new username to switch to :type username: string :param password: the new password to switch to :type password: string
switch_user
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def write(self, data): """Provide as convenience for influxdb v0.9.0, this may change.""" self.request( url="write", method='POST', params=None, data=data, expected_response_code=200 ) return True
Provide as convenience for influxdb v0.9.0, this may change.
write
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def write_points(self, data, time_precision='s', *args, **kwargs): """Write to multiple time series names. An example data blob is: data = [ { "points": [ [ 12 ] ], "name...
Write to multiple time series names. An example data blob is: data = [ { "points": [ [ 12 ] ], "name": "cpu_load_short", "columns": [ "value" ...
write_points
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def write_points_with_precision(self, data, time_precision='s'): """Write to multiple time series names. DEPRECATED. """ warnings.warn( "write_points_with_precision is deprecated, and will be removed " "in future versions. Please use " "``InfluxDBClie...
Write to multiple time series names. DEPRECATED.
write_points_with_precision
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def create_database(self, database): """Create a database on the InfluxDB server. :param database: the name of the database to create :type database: string :rtype: boolean """ url = "db" data = {'name': database} self.request( url=url, ...
Create a database on the InfluxDB server. :param database: the name of the database to create :type database: string :rtype: boolean
create_database
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def delete_database(self, database): """Drop a database on the InfluxDB server. :param database: the name of the database to delete :type database: string :rtype: boolean """ url = "db/{0}".format(database) self.request( url=url, method='...
Drop a database on the InfluxDB server. :param database: the name of the database to delete :type database: string :rtype: boolean
delete_database
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def get_database_list(self): """Get the list of databases. DEPRECATED. """ warnings.warn( "get_database_list is deprecated, and will be removed " "in future versions. Please use " "``InfluxDBClient.get_list_database`` instead.", FutureWarn...
Get the list of databases. DEPRECATED.
get_database_list
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def delete_series(self, series): """Drop a series on the InfluxDB server. :param series: the name of the series to delete :type series: string :rtype: boolean """ url = "db/{0}/series/{1}".format( self._database, series ) self.req...
Drop a series on the InfluxDB server. :param series: the name of the series to delete :type series: string :rtype: boolean
delete_series
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def get_list_series(self): """Get a list of all time series in a database.""" response = self._query('list series') return [series[1] for series in response[0]['points']]
Get a list of all time series in a database.
get_list_series
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def add_database_user(self, new_username, new_password, permissions=None): """Add database user. :param permissions: A ``(readFrom, writeTo)`` tuple """ url = "db/{0}/users".format(self._database) data = { 'name': new_username, 'password': new_password ...
Add database user. :param permissions: A ``(readFrom, writeTo)`` tuple
add_database_user
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def alter_database_user(self, username, password=None, permissions=None): """Alter a database user and/or their permissions. :param permissions: A ``(readFrom, writeTo)`` tuple :raise TypeError: if permissions cannot be read. :raise ValueError: if neither password nor permissions provid...
Alter a database user and/or their permissions. :param permissions: A ``(readFrom, writeTo)`` tuple :raise TypeError: if permissions cannot be read. :raise ValueError: if neither password nor permissions provided.
alter_database_user
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def send_packet(self, packet): """Send a UDP packet along the wire.""" data = json.dumps(packet) byte = data.encode('utf-8') self.udp_socket.sendto(byte, (self._host, self._udp_port))
Send a UDP packet along the wire.
send_packet
python
influxdata/influxdb-python
influxdb/influxdb08/client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/client.py
MIT
def __init__(self, ignore_nan=True, *args, **kwargs): """Initialize an instance of the DataFrameClient.""" super(DataFrameClient, self).__init__(*args, **kwargs) try: global pd import pandas as pd except ImportError as ex: raise ImportError('DataFrame...
Initialize an instance of the DataFrameClient.
__init__
python
influxdata/influxdb-python
influxdb/influxdb08/dataframe_client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/dataframe_client.py
MIT
def write_points(self, data, *args, **kwargs): """Write to multiple time series names. :param data: A dictionary mapping series names to pandas DataFrames :param time_precision: [Optional, default 's'] Either 's', 'm', 'ms' or 'u'. :param batch_size: [Optional] Value to writ...
Write to multiple time series names. :param data: A dictionary mapping series names to pandas DataFrames :param time_precision: [Optional, default 's'] Either 's', 'm', 'ms' or 'u'. :param batch_size: [Optional] Value to write the points in batches instead of all at one ...
write_points
python
influxdata/influxdb-python
influxdb/influxdb08/dataframe_client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/dataframe_client.py
MIT
def write_points_with_precision(self, data, time_precision='s'): """Write to multiple time series names. DEPRECATED """ warnings.warn( "write_points_with_precision is deprecated, and will be removed " "in future versions. Please use " "``DataFrameClie...
Write to multiple time series names. DEPRECATED
write_points_with_precision
python
influxdata/influxdb-python
influxdb/influxdb08/dataframe_client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/dataframe_client.py
MIT
def query(self, query, time_precision='s', chunked=False): """Query data into DataFrames. Returns a DataFrame for a single time series and a map for multiple time series with the time series as value and its name as key. :param time_precision: [Optional, default 's'] Either 's', 'm', '...
Query data into DataFrames. Returns a DataFrame for a single time series and a map for multiple time series with the time series as value and its name as key. :param time_precision: [Optional, default 's'] Either 's', 'm', 'ms' or 'u'. :param chunked: [Optional, default=Fal...
query
python
influxdata/influxdb-python
influxdb/influxdb08/dataframe_client.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/dataframe_client.py
MIT
def __new__(cls, *args, **kwargs): """Initialize class attributes for subsequent constructor calls. :note: *args and **kwargs are not explicitly used in this function, but needed for Python 2 compatibility. """ if not cls.__initialized__: cls.__initialized__ = True ...
Initialize class attributes for subsequent constructor calls. :note: *args and **kwargs are not explicitly used in this function, but needed for Python 2 compatibility.
__new__
python
influxdata/influxdb-python
influxdb/influxdb08/helper.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/helper.py
MIT
def __init__(self, **kw): """Create a new data point. All fields must be present. :note: Data points written when `bulk_size` is reached per Helper. :warning: Data points are *immutable* (`namedtuples`). """ cls = self.__class__ if sorted(cls._fields) != sorted...
Create a new data point. All fields must be present. :note: Data points written when `bulk_size` is reached per Helper. :warning: Data points are *immutable* (`namedtuples`).
__init__
python
influxdata/influxdb-python
influxdb/influxdb08/helper.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/helper.py
MIT
def _json_body_(cls): """Return JSON body of the datapoints. :return: JSON body of the datapoints. """ json = [] if not cls.__initialized__: cls._reset_() for series_name, data in six.iteritems(cls._datapoints): json.append({'name': series_name, ...
Return JSON body of the datapoints. :return: JSON body of the datapoints.
_json_body_
python
influxdata/influxdb-python
influxdb/influxdb08/helper.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/influxdb08/helper.py
MIT
def test_load(self): """Test reading a sequence of JSON values from a string.""" example_response = \ '{"results": [{"series": [{"measurement": "sdfsdfsdf", ' \ '"columns": ["time", "value"], "values": ' \ '[["2009-11-10T23:00:00Z", 0.64]]}]}, {"series": ' \ ...
Test reading a sequence of JSON values from a string.
test_load
python
influxdata/influxdb-python
influxdb/tests/chunked_json_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/chunked_json_test.py
MIT
def request(*args, **kwargs): """Request content from the mocked session.""" c = content # Check method assert method == kwargs.get('method', 'GET') if method == 'POST': data = kwargs.get('data', None) if data is not None: # Data must be...
Request content from the mocked session.
request
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def setUp(self): """Initialize an instance of TestInfluxDBClient object.""" # By default, raise exceptions on warnings warnings.simplefilter('error', FutureWarning) self.cli = InfluxDBClient('localhost', 8086, 'username', 'password') self.dummy_points = [ { ...
Initialize an instance of TestInfluxDBClient object.
setUp
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_scheme(self): """Set up the test schema for TestInfluxDBClient object.""" cli = InfluxDBClient('host', 8086, 'username', 'password', 'database') self.assertEqual('http://host:8086', cli._baseurl) cli = InfluxDBClient( 'host', 8086, 'username', 'password', 'database'...
Set up the test schema for TestInfluxDBClient object.
test_scheme
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_dsn(self): """Set up the test datasource name for TestInfluxDBClient object.""" cli = InfluxDBClient.from_dsn('influxdb://192.168.0.1:1886') self.assertEqual('http://192.168.0.1:1886', cli._baseurl) cli = InfluxDBClient.from_dsn(self.dsn_string) self.assertEqual('http:/...
Set up the test datasource name for TestInfluxDBClient object.
test_dsn
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_cert(self): """Test mutual TLS authentication for TestInfluxDBClient object.""" cli = InfluxDBClient(ssl=True, cert='/etc/pki/tls/private/dummy.crt') self.assertEqual(cli._session.cert, '/etc/pki/tls/private/dummy.crt') with self.assertRaises(ValueError): cli = Infl...
Test mutual TLS authentication for TestInfluxDBClient object.
test_cert
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_switch_database(self): """Test switch database in TestInfluxDBClient object.""" cli = InfluxDBClient('host', 8086, 'username', 'password', 'database') cli.switch_database('another_database') self.assertEqual('another_database', cli._database)
Test switch database in TestInfluxDBClient object.
test_switch_database
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_switch_user(self): """Test switch user in TestInfluxDBClient object.""" cli = InfluxDBClient('host', 8086, 'username', 'password', 'database') cli.switch_user('another_username', 'another_password') self.assertEqual('another_username', cli._username) self.assertEqual('an...
Test switch user in TestInfluxDBClient object.
test_switch_user
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points(self): """Test write points for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/write", status_code=204 ) cli = InfluxDBCl...
Test write points for TestInfluxDBClient object.
test_write_points
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_gzip(self): """Test write points for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/write", status_code=204 ) cli = Influ...
Test write points for TestInfluxDBClient object.
test_write_points_gzip
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_toplevel_attributes(self): """Test write points attrs for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/write", status_code=204 ) ...
Test write points attrs for TestInfluxDBClient object.
test_write_points_toplevel_attributes
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_batch(self): """Test write points batch for TestInfluxDBClient object.""" dummy_points = [ {"measurement": "cpu_usage", "tags": {"unit": "percent"}, "time": "2009-11-10T23:00:00Z", "fields": {"value": 12.34}}, {"measurement": "network", "tags": ...
Test write points batch for TestInfluxDBClient object.
test_write_points_batch
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_batch_generator(self): """Test write points batch from a generator for TestInfluxDBClient.""" dummy_points = [ {"measurement": "cpu_usage", "tags": {"unit": "percent"}, "time": "2009-11-10T23:00:00Z", "fields": {"value": 12.34}}, {"measurement":...
Test write points batch from a generator for TestInfluxDBClient.
test_write_points_batch_generator
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_udp(self): """Test write points UDP for TestInfluxDBClient object.""" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) port = random.randint(4000, 8000) s.bind(('0.0.0.0', port)) cli = InfluxDBClient( 'localhost', 8086, 'root', 'root', ...
Test write points UDP for TestInfluxDBClient object.
test_write_points_udp
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_fails(self): """Test write points fail for TestInfluxDBClient object.""" cli = InfluxDBClient('host', 8086, 'username', 'password', 'db') with _mocked_session(cli, 'post', 500): cli.write_points([])
Test write points fail for TestInfluxDBClient object.
test_write_points_fails
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_with_precision(self): """Test write points with precision for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/write", status_code=204 )...
Test write points with precision for TestInfluxDBClient object.
test_write_points_with_precision
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_with_consistency(self): """Test write points with consistency for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, 'http://localhost:8086/write', status_code=204 ...
Test write points with consistency for TestInfluxDBClient object.
test_write_points_with_consistency
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_with_precision_udp(self): """Test write points with precision for TestInfluxDBClient object.""" s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) port = random.randint(4000, 8000) s.bind(('0.0.0.0', port)) cli = InfluxDBClient( 'localhost', 8...
Test write points with precision for TestInfluxDBClient object.
test_write_points_with_precision_udp
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_bad_precision(self): """Test write points w/bad precision TestInfluxDBClient object.""" cli = InfluxDBClient() with self.assertRaisesRegexp( Exception, "Invalid time precision is given. " "\(use 'n', 'u', 'ms', 's', 'm' or 'h'\)" ...
Test write points w/bad precision TestInfluxDBClient object.
test_write_points_bad_precision
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_bad_consistency(self): """Test write points w/bad consistency value.""" cli = InfluxDBClient() with self.assertRaises(ValueError): cli.write_points( self.dummy_points, consistency='boo' )
Test write points w/bad consistency value.
test_write_points_bad_consistency
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_write_points_with_precision_fails(self): """Test write points w/precision fail for TestInfluxDBClient object.""" cli = InfluxDBClient('host', 8086, 'username', 'password', 'db') with _mocked_session(cli, 'post', 500): cli.write_points_with_precision([])
Test write points w/precision fail for TestInfluxDBClient object.
test_write_points_with_precision_fails
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_query(self): """Test query method for TestInfluxDBClient object.""" example_response = ( '{"results": [{"series": [{"measurement": "sdfsdfsdf", ' '"columns": ["time", "value"], "values": ' '[["2009-11-10T23:00:00Z", 0.64]]}]}, {"series": ' '[{"mea...
Test query method for TestInfluxDBClient object.
test_query
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_query_msgpack(self): """Test query method with a messagepack response.""" example_response = bytes(bytearray.fromhex( "81a7726573756c74739182ac73746174656d656e745f696400a673657269" "65739183a46e616d65a161a7636f6c756d6e7392a474696d65a176a67661" "6c7565739192c7...
Test query method with a messagepack response.
test_query_msgpack
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_query_chunked(self): """Test chunked query for TestInfluxDBClient object.""" cli = InfluxDBClient(database='db') example_object = { 'points': [ [1415206250119, 40001, 667], [1415206244555, 30001, 7], [1415206228241, 20001, 788]...
Test chunked query for TestInfluxDBClient object.
test_query_chunked
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_query_fail(self): """Test query failed for TestInfluxDBClient object.""" with _mocked_session(self.cli, 'get', 401): self.cli.query('select column_one from foo;')
Test query failed for TestInfluxDBClient object.
test_query_fail
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_create_database(self): """Test create database for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/query", text='{"results":[{}]}' ) sel...
Test create database for TestInfluxDBClient object.
test_create_database
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_create_numeric_named_database(self): """Test create db w/numeric name for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/query", text='{"results":[{}]}' ...
Test create db w/numeric name for TestInfluxDBClient object.
test_create_numeric_named_database
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_drop_database(self): """Test drop database for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/query", text='{"results":[{}]}' ) self.cl...
Test drop database for TestInfluxDBClient object.
test_drop_database
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_drop_measurement(self): """Test drop measurement for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/query", text='{"results":[{}]}' ) s...
Test drop measurement for TestInfluxDBClient object.
test_drop_measurement
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_drop_numeric_named_database(self): """Test drop numeric db for TestInfluxDBClient object.""" with requests_mock.Mocker() as m: m.register_uri( requests_mock.POST, "http://localhost:8086/query", text='{"results":[{}]}' ) ...
Test drop numeric db for TestInfluxDBClient object.
test_drop_numeric_named_database
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_get_list_database(self): """Test get list of databases for TestInfluxDBClient object.""" data = {'results': [ {'series': [ {'name': 'databases', 'values': [ ['new_db_1'], ['new_db_2']], 'colu...
Test get list of databases for TestInfluxDBClient object.
test_get_list_database
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT
def test_get_list_database_fails(self): """Test get list of dbs fail for TestInfluxDBClient object.""" cli = InfluxDBClient('host', 8086, 'username', 'password') with _mocked_session(cli, 'get', 401): cli.get_list_database()
Test get list of dbs fail for TestInfluxDBClient object.
test_get_list_database_fails
python
influxdata/influxdb-python
influxdb/tests/client_test.py
https://github.com/influxdata/influxdb-python/blob/master/influxdb/tests/client_test.py
MIT