semvec/pypi-packages huggingface dataset:
garf-google-analytics 1.0.0
Garf implementation for Google Analytics API
License: Apache 2.0
Requires Python: >=3.8

# `garf` for Google Analytics API

[![PyPI](https://img.shields.io/pypi/v/garf-google-analytics?logo=pypi&logoColor=white&style=flat-square)](https://pypi.org/project/garf-google-analytics)
[![Downloads PyPI](https://img.shields.io/pypi/dw/garf-google-analytics?logo=pypi)](https://pypi.org/project/garf-google-analytics/)

`garf-google-analytics` simplifies fetching data from Google Analytics API using SQL-like queries.

## Prerequisites

* [Google Analytics API](https://console.cloud.google.com/apis/library/analytics.googleapis.com) enabled.

## Installation

`pip install garf-google-analytics`

## Usage

### Run as a library
```
from garf.community.google.analytics import GoogleAnalyticsApiReportFetcher
from garf.io import writer

# Fetch report
fetched_report = (
  GoogleAnalyticsApiReportFetcher()
  .fetch(query, query="<YOUR_QUERY_HERE">, property_id=PROPERTY_ID)
)

# Write report to console
console_writer = writer.create_writer('console')
console_writer.write(fetched_report, 'output')
```

### Run via CLI

> Install `garf-executors` package to run queries via CLI (`pip install garf-executors`).

```
garf <PATH_TO_QUERIES> --source google-analytics \
  --output <OUTPUT_TYPE> \
  --source.<SOURCE_PARAMETER=VALUE>
```

where:

* `<PATH_TO_QUERIES>` - local or remove files containing queries
* `<OUTPUT_TYPE>` - output supported by [`garf-io` library](../garf_io/README.md).
* `<SOURCE_PARAMETER=VALUE` - key-value pairs to refine fetching, check [available source parameters](#available-source-parameters).

## Available source parameters

| name | values| comments |
|----- | ----- | -------- |
| `property_id`   | Property to get data to | Multiple properties are supported, should be comma-separated|
garf-merchant-api 1.0.0
Garf implementation for Google Merchant API
License: Apache 2.0
Requires Python: >=3.8

# `garf` for Merchant API

[![PyPI](https://img.shields.io/pypi/v/garf-merchant-api?logo=pypi&logoColor=white&style=flat-square)](https://pypi.org/project/garf-merchant-api)
[![Downloads PyPI](https://img.shields.io/pypi/dw/garf-merchant-api?logo=pypi)](https://pypi.org/project/garf-merchant-api/)

`garf-merchant-api` simplifies fetching data from Merchant API using SQL-like queries.

## Prerequisites

* [Merchant API](https://console.cloud.google.com/apis/library/merchantapi.googleapis.com) enabled.

## Installation

`pip install garf-merchant-api`

## Usage

### Run as a library
```
from garf.community.google.merchant import report_fetcher
from garf.io import writer


# Specify query
query = """
  SELECT
    date,
    clicks
    FROM product_performance_view
    WHERE date BETWEEN '2023-12-01' AND '2023-12-03'
  ORDER BY clicks DESC
""

# Fetch report
fetched_report = (
  report_fetcher.MerchantApiReportFetcher()
  .fetch(query, query="<YOUR_SEARCH_QUERY_HERE">, account=ACCOUNT_ID)
)

# Write report to console
console_writer = writer.create_writer('console')
console_writer.write(fetched_report, 'output')
```

### Run via CLI

> Install `garf-executors` package to run queries via CLI (`pip install garf-executors`).

```
garf <PATH_TO_QUERIES> --source merchant-api \
  --output <OUTPUT_TYPE> \
  --source.<SOURCE_PARAMETER=VALUE>
```

where:

* `<PATH_TO_QUERIES>` - local or remove files containing queries
* `<OUTPUT_TYPE>` - output supported by [`garf-io` library](../garf_io/README.md).
* `<SOURCE_PARAMETER=VALUE` - key-value pairs to refine fetching, check [available source parameters](#available-source-parameters).

## Available source parameters

| name | values| comments |
|----- | ----- | -------- |
| `account`   | Account(s) to get data to | Multiple accounts are supported, should be comma-separated|
garf-exporter 1.0.0
Exports data from APIs to Prometheus
License: Apache 2.0
Requires Python: >=3.9

# garf exporter - Prometheus exporter for garf.

[![PyPI](https://img.shields.io/pypi/v/garf-exporter?logo=pypi&logoColor=white&style=flat-square)](https://pypi.org/project/garf-exporter)
[![Downloads PyPI](https://img.shields.io/pypi/dw/garf-exporter?logo=pypi)](https://pypi.org/project/garf-exporter/)

`garf-exporter` allows you to transform responses from APIs into metrics consumable for by Prometheus.
Simply define a config file with garf queries and run a single `garf-exporter` command to start exporting in no time!


## Installation


```bash
pip install garf-exporter
```

## Usage

`garf-exporter` expects a configuration file that contains garf-queries mapped to collector names.

Config file may contains one or several queries.

```yaml
- title: test
  query: |
    SELECT
      dimension,
      metric,
      metric_clicks,
      campaign
    FROM resource
```

> To treat any field in SELECT statement as metric prefix with with `metric_`.

You need to explicitly specify source of API and path to config file to start exporting data.

```bash
garf-exporter --source API_SOURCE -c config.yaml
```

Once `garf-exporter` is running you can see exposed metrics at `localhost:8000/metrics`.

### Customization

* `--config` - path to `garf_exporter.yaml`, can be taken from local or remote file.
* `--expose-type` - type of exposition (`http` or `pushgateway`, `http` is used by default)
* `--host` - address of your http server (`localhost` by default)
* `--port` - port of your http server (`8000` by default)
* `--delay-minutes` - delay in minutes between scrapings (`15` by default)

## Documentation

Explore full documentation on using `garf-exporter`

* [Documentation](https://google.github.io/garf/usage/exporters/)
garf-knowledge-graph-api 1.0.0
description
License: Apache 2.0
Requires Python: >=3.8

# `garf` for Knowledge Graph Search API

[![PyPI](https://img.shields.io/pypi/v/garf-knowledge-graph-api?logo=pypi&logoColor=white&style=flat-square)](https://pypi.org/project/garf-knowledge-graph-api)
[![Downloads PyPI](https://img.shields.io/pypi/dw/garf-knowledge-graph-api?logo=pypi)](https://pypi.org/project/garf-knowledge-graph-api/)

`garf-knowledge-graph-api` simplifies fetching data from Knowledge Graph Search API using SQL-like queries.

## Prerequisites

* [Knowledge Graph Search API](https://console.cloud.google.com/apis/library/kgsearch.googleapis.com) enabled.
* [API key](https://support.google.com/googleapi/answer/6158862?hl=en) to access to access Knowledge Graph Search API.
    > Once generated expose API key as `export KG_API_KEY=<YOUR_API_KEY>`

## Installation

`pip install garf-knowledge-graph-api`

## Usage

### Run as a library
```
from garf.community.google.knowledge_graph import report_fetcher
from garf.io import writer


# Specify query
query = """
  SELECT
    result_score,
    @id AS id,
    @type AS type,
    description,
    image.url AS url
  FROM query
  WHERE {query}
""

# Fetch report
fetched_report = (
  report_fetcher.KnowledgeGraphApiReportFetcher()
  .fetch(query, query="<YOUR_SEARCH_QUERY_HERE">)
)

# Write report to console
console_writer = writer.create_writer('console')
console_writer.write(fetched_report, 'output')
```

### Run via CLI

> Install `garf-executors` package to run queries via CLI (`pip install garf-executors`).

```
garf <PATH_TO_QUERIES> --source knowledge-graph-api \
  --output <OUTPUT_TYPE> \
  --source.<SOURCE_PARAMETER=VALUE>
```

where:

* `<PATH_TO_QUERIES>` - local or remove files containing queries
* `<OUTPUT_TYPE>` - output supported by [`garf-io` library](../garf_io/README.md).
* `<SOURCE_PARAMETER=VALUE` - key-value pairs to refine fetching, check [available source parameters](#available-source-parameters).

## Available source parameters

| name | values| comments |
|----- | ----- | -------- |
| `ids`   | One or many Knowledge Graph Ids | Multiple ids are supported, should be comma-separated|
| `query` | Search query | i.e. "Radiohead" |