googleads / googleads/googleads-python-lib
NameError: name 'oauth2' is not defined when running client library setup code
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 749
- Forks
- 967
- PR merge metrics
- No merged PRs in 30d
Description
When running the code in https://github.com/googleads/googleads-python-lib/wiki/API-access-on-behalf-of-your-clients-(web-flow)#step-2---setting-up-the-client-library I am encountering NameError: name 'oauth2' is not defined. This seems to be correct because there is no import anywhere of any oauth2 namespace.
If I change the code to
from google import oauth2
import google.oauth2.credentials
import google_auth_oauthlib.flow
flow = google_auth_oauthlib.flow.Flow.from_client_secrets_file(
'client_secrets.json',
scope=[oauth2.GetAPIScope('adwords')])
I get a new error: AttributeError: 'module' object has no attribute 'GetAPIScope'
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review Step 2 of the linked wiki page, especially the oauth2 reference and the google_auth_oauthlib.flow.Flow.from_client_secrets_file example. Verify the documented imports and scope helper against the current Python client setup, then update the example so it runs without the reported NameError or AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100