package to ingest data in Google Sheets file for FInOps reporting
Project description
FORE stand for Fin Ops REporter
Autentication and authorization Overview
This package will be published on PyPi as downloadable package.
The main purpose of it is to Oauth2 authenticate a user of the Jupiter Notebook (JpN) that will need access to Google Sheets application. The security context is the current macOS user who use the Jupiter notebook and is logged in with Google's account.
In order to ustilize the Google's Sheets API the JpN code would need to:
- enable Google Sheet API in the GCP project where the application is registered.
- install the package
forefrom PyPi; - recieve a file
credentials.jsonfrom her line manager and copy it to~/crgoauthfolder. This file contains the JpN application's credentials. The security context for the credentials ishttps://www.googleapis.com/auth/spreadsheets; - Logging in the Cloudreach's google account and in the prompted window authorized the JpN application to access the Google Sheets API.
As of the initial version, the authentication of the user is performed over the Google's SignIn of the currently logged user in the Google account in the browser.
The authentication token is stored in a subfolder crgoauth in the current user's folder on the local machine (macOS tested). For every authentication attempt the token will be taken from the file from that location only.
In order to work with Google's Sheets API, a credentials file is required as well as outcome of registering this library as desktop application in Google Cloud.
The credentials file is always sought in the subfolder crgoauth of the current user's folder on the local machine.
TODO [dev]: to implemnt posibility to store the token and application credentials into Secret MAnager.
HowTos
- Import customer's report data from pandas' DataFrame:
- using the fore_cloudreach library in Jupyter notebook:
example-1:
!pip install fore_cloudreach
import fore_cloudreach as fc
try:
ing = fc.Ingester("<customers_map>")
rsl = ing.load_from_df("customer", <data_frame>)
print(rsl)
except Exception as err:
print("An exception raised: {err}!")
where:
- <
customers_map> is the file ID from the URL of a Google's Sheets file containing the mapping between a customer and its report file ID.
*Example:*
</br>
*The file ID to pickup from the file URL*

and then:
```python
ing = fc.Ingester("1FE0KDANyCLk_zhyxCsIGPR4ifaktD9xMt...")
```
The mapping file format:

**IMPORTANT !!!**
The customer mapping tab sheet MUST be named <`Map`>!
-
<
customer> is one of customer name or customer id (as string) as it is used in the mapping file described above. -
<
data_frame> - is pandas Data Frame with the data to be uploaded in the customers report sheet.
example-2:
- Install the library
pip install fore_cloudreach
# on Jupyter notebook:
! pip install fore_cloudreach
- Import and usage
import fore_cloudreach as fc
# ... Acquire the customer's reports data into pandas Data Frame or CSV file
#
# ... create an Ingester object by next statement
# where `mapping_file_id` is the unique file ID from the URL of the Google Sheets file. This must be a configuration file that maps
# the customers to their Google Sheets report file per each customer.
ing = fc.Ingester(mapping_file_id="1fL3rZDj8tCP4povb3E2x_WmkqNmfEZIR...")
# to load the report from pandas DF run the following code, where you need:
# the customer name (str) and the data set as pandas Data Frame
rsl = ing.load_report(customer="<customer_name>", data=df)
# to load the report from CSV file run the following code, where you need:
# the customer name (str) and the data = string as relative path to the CSV file
rsl2 = ing.load_report(customer="<customer_name>", data="docs/samples/aws_ec2_rightsizing.Csv")
# the returned result will show a summary of a successful import
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fore_cloudreach-0.0.1.dev9.tar.gz.
File metadata
- Download URL: fore_cloudreach-0.0.1.dev9.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb90625a271973048fb5b06037b8f8901a6dabd8bc601d5baeb832203eca5568
|
|
| MD5 |
c83ff58155710fb19f8a92ee4558e4c6
|
|
| BLAKE2b-256 |
b4fba4720773343cbbc94119952d2e5b63d97644b7030fcf64d4d5ce4c64dc47
|
File details
Details for the file fore_cloudreach-0.0.1.dev9-py3-none-any.whl.
File metadata
- Download URL: fore_cloudreach-0.0.1.dev9-py3-none-any.whl
- Upload date:
- Size: 13.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67aeceb9e29603cb697085f462a6705681fd26772f8390bf221aed3b000caba6
|
|
| MD5 |
23def5fa0dfbe4130818dcd59b5aa644
|
|
| BLAKE2b-256 |
8f23b55e7de5cbe93f23c74283038628c79bccf16ce7241a9ddb31892e815d4c
|