跳转到主要内容

Google API的用户友好封装器

项目描述

gwrappy

https://img.shields.io/pypi/v/gwrappy.svg Documentation Status

Google API的用户友好封装器。

功能

  • 轻松连接到以下Google API(最终将提供更多)
    • BigQuery

    • 云存储

    • 驱动器

    • gmail

    • 计算引擎

# BigQuery
from gwrappy.bigquery import BigqueryUtility
bq_obj = BigqueryUtility()
results = bq_obj.sync_query('my_project', 'SELECT * FROM [foo.bar]')

# Cloud Storage
from gwrappy.storage import GcsUtility
gcs_obj = GcsUtility()
gcs_obj.download_object('bucket_name', 'object_name', 'path/to/write')
gcs_obj.upload_object('bucket_name', 'object_name', 'path/to/read')

# Drive
from gwrappy.drive import DriveUtility
drive_obj = DriveUtility(json_credentials_path, client_id)
drive_obj.download_object('file_id', 'path/to/write')
drive_obj.upload_file('path/to/read')

# Gmail
from gwrappy.gmail import GmailUtility
gmail_obj = GmailUtility(json_credentials_path, client_id)
gmail_obj.send_email(sender='Daniel Poon', to=['recipient_1@xx.com', 'recipient_2@yy.com'], subject='Hello World!', message_text='My First Email')

安装

$ pip install gwrappy

历史

0.4.3 (2016-12-16)

  • 修复gwrappy.drive.DriveUtility.upload_file()中的错误

0.4.2 (2016-12-16)

  • 修复gwrappy.dataproc.DataprocUtility.delete_cluster()中的错误

0.4.1 (2016-12-14)

  • 重大变更
    • gwrappy.dataproc.DataprocUtility的构造函数现在接收project_id而不是方法参数。

  • gwrappy.dataproc.DataprocUtility操作/作业方法在wait_finish=True时返回Response对象

  • 从requirements.txt中删除了pandas依赖项,因为其功能仅限于特定函数,否则大多不必要。

0.4.0 (2016-11-21)

  • 添加了gwrappy.dataproc以支持Google Dataproc

  • 小变更
    • 添加了gwrappy.storage.GcsUtility.update_object()

    • 使用gwrappy.storage.GcsUtility.upload_object()上传对象时,可以设置对象Acl

0.3.0 (2016-10-31)

  • Python 3兼容性
    • 大多数API函数已经兼容,大多数更改都是为了实用函数而进行的。

  • 小错误修复/变更
    • BigqueryUtility().poll_resp_list()现在在遇到异常时不会中断。将返回相应的Error对象,并且作业检查将不间断。

    • 修复了在查询到dataframe时将int列解释为float的pandas 0.19.0错误。

0.2.1 (2016-10-20)

  • 小错误修复
    • bigquery.utils.read_sql正确检查kwargs。

    • 使用return_type=’dataframe’的BigqueryUtility查询为整数列使用推断的dtypes,以防止pandas在列包含NaN时中断。

0.2.0 (2016-09-27)

  • 添加了gwrappy.compute以支持Google Compute Engine。

  • 小错误修复
    • drive.DriveUtility.list_files():删除字段,添加orderBy和filter_exp。

    • 修复了某些作业类型中bigquery.utils.JobResponse的time_taken在__repr__中的问题。

0.1.6 (2016-09-08)

  • 添加了更多实用工具
    • utils.month_range: 将日期块化到月份。

    • utils.simple_mail: 发送基本电子邮件用于警报或测试。注意:为了更高的安全性和灵活性,仍然使用此包内的gmail功能。

    • utils.StringLogger: 用于具有字符串处理程序和方便函数(用于将日志作为字符串检索)的简单日志包装器。

  • 将dateutil添加为依赖项

0.1.5 (2016-08-30)

  • 列表方法现在返回生成器以提高内存效率

  • BigQuery
    • list_jobs新增了两个参数projectionearliest_date

  • 更新文档

0.1.4 (2016-08-29)

  • gwrappy.errors不再导入特定服务的错误对象。要访问JobError,从gwrappy.bigquery.errors导入。

  • 在gwrappy.utils中添加了简单的日期范围生成函数

0.1.3 (2016-08-23)

  • BigQuery
    • JobResponse现在仅在数据可用时设置time_taken。
      • 修复了当wait_finish=False时引发KeyError的bug,因为API响应中不可用endTime。

    • poll_resp_list返回JobReponse对象。如果可用,还传播'description'属性。

0.1.2 (2016-08-19)

  • 错误修复

  • 更新文档

0.1.1 (2016-08-16)

  • 完成了docstrings和文档的修正

  • 在gwrappy.gmail.utils下添加了list_to_html

  • 添加了tabulate作为依赖项

0.1.0 (2016-08-15)

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源分发

gwrappy-0.4.3.tar.gz (39.3 kB 查看哈希)

上传时间

由以下组织支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面