Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.quotas() error #21

Closed
tmegow opened this issue Sep 16, 2020 · 5 comments · Fixed by #24
Closed

client.quotas() error #21

tmegow opened this issue Sep 16, 2020 · 5 comments · Fixed by #24
Assignees
Labels
api: dns Issues related to the googleapis/python-dns API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tmegow
Copy link

tmegow commented Sep 16, 2020

  • OS type and version: macOS Mojave (10.14.6 (18G5033))
  • Python version: Python 3.7.4
  • pip version: pip 20.2.3 from /Users/thadmegow/dev/google-cloud-dns/.venv/lib/python3.7/site-packages/pip (python 3.7)
  • google-cloud-dns version:
Version: 0.32.0
Summary: Google Cloud DNS API client library
Home-page: https://github.com/googleapis/python-dns
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /Users/thadmegow/dev/google-cloud-dns/.venv/lib/python3.7/site-packages
Requires: google-cloud-core
Required-by:

Steps to reproduce

  1. Ensure authentication is properly setup (I'm using a Service Account)
  2. Execute code below, substituting "my-project" for a valid projectID

Code example

from google.cloud import dns
client = dns.Client(project="my-project")
quotas = client.quotas()  # API request

image

Stack trace

Traceback (most recent call last):
  File "google-cloud-dns-search.py", line 3, in <module>
    quotas = client.quotas()  # API request
  File "/Users/thadmegow/dev/google-cloud-dns/.venv/lib/python3.7/site-packages/google/cloud/dns/client.py", line 100, in quotas
    key: int(value) for key, value in resp["quota"].items() if key != "kind"
  File "/Users/thadmegow/dev/google-cloud-dns/.venv/lib/python3.7/site-packages/google/cloud/dns/client.py", line 100, in <dictcomp>
    key: int(value) for key, value in resp["quota"].items() if key != "kind"
TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'
@product-auto-label product-auto-label bot added the api: dns Issues related to the googleapis/python-dns API. label Sep 16, 2020
@busunkim96
Copy link
Contributor

I'm able to reproduce this locally. My theory is that resp is borked in some way and the typeerror is from the library attempting to parse it as normal.

resp = self._connection.api_request(method="GET", path=path)

@tmegow Do you have information on when this stopped working?

@busunkim96 busunkim96 added priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels Sep 16, 2020
@tmegow
Copy link
Author

tmegow commented Sep 16, 2020

I'm able to reproduce this locally. My theory is that resp is borked in some way and the typeerror is from the library attempting to parse it as normal.

resp = self._connection.api_request(method="GET", path=path)

@tmegow Do you have information on when this stopped working?

Thank you for investigating! Unfortunately, no I don't have any more contextual info.

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. and removed 🚨 This issue needs some love. labels Sep 21, 2020
@busunkim96
Copy link
Contributor

The quota resource object has a new field whitelistedKeySpecs which is a list of dictionaries. Will open a PR to update the logic shortly.

https://cloud.google.com/dns/docs/reference/v1/projects#resource

{
  "kind": "dns#project",
  "number": unsigned long,
  "id": string,
  "quota": {
    "kind": "dns#quota",
    "managedZones": integer,
    "rrsetsPerManagedZone": integer,
    "rrsetAdditionsPerChange": integer,
    "rrsetDeletionsPerChange": integer,
    "totalRrdataSizePerChange": integer,
    "resourceRecordsPerRrset": integer,
    "dnsKeysPerManagedZone": integer,
    "whitelistedKeySpecs": [
      {
        "kind": "dns#dnsKeySpec",
        "keyType": string,
        "algorithm": string,
        "keyLength": unsigned integer
      }
    ],
    "networksPerManagedZone": integer,
    "managedZonesPerNetwork": integer,
    "policies": integer,
    "networksPerPolicy": integer,
    "targetNameServersPerPolicy": integer,
    "targetNameServersPerManagedZone": integer
  }
}

@tmegow
Copy link
Author

tmegow commented Oct 9, 2020

thank you!

@busunkim96
Copy link
Contributor

@tmegow Of course, thank you for your patience! The library will be released on Monday with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: dns Issues related to the googleapis/python-dns API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. 🚨 This issue needs some love. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants