Alerts API returns 400 Error Part 2
See original GitHub issueThanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you’ve tried the usual “quick fixes”:
- Search the issues already opened: https://github.com/googleapis/google-api-python-client/issues
- If you have a question, post on Stackoverflow under the
google-api
tag. - If you are reporting an issue or requesting a feature for a G Suite API, please use their public issue tracker
If you are still having issues, please be sure to include as much information as possible:
Environment details
- OS: Darwin 18.6.0
- Python version: 3.6.5
- pip version: 19.2.3
google-api-python-client
version:1.7.8
Steps to reproduce
- This is a clone of this issue: https://github.com/googleapis/google-api-python-client/issues/645
- My SA was made through the
Using OAuth 2.0 for Server to Server Applications
documentation provided as further reading to the original documentation page. I granted domain-wide access to the service account from the Servie Account panel and used that to grab the client ID.
Code:
from googleapiclient.discovery import build
from google.oauth2 import service_account
class AlertCenterExtractor:
def __init__(self):
# build servie and scopes
self.scopes = ["https://www.googleapis.com/auth/apps.alerts"]
self.credentials = service_account.Credentials.from_service_account_file(
"SERVICEACCOUNT.JSON", scopes=self.scopes)
self.service = build('alertcenter', 'v1beta1', credentials=self.credentials).alerts()
""" Gets alerts and writes them to output directory. """
def get_alerts(self):
recent_alerts = self.service.list(customerId="my_customer_id").execute()
if __name__ == '__main__':
alert_center_class = AlertCenterExtractor()
alert_center_class.get_alerts()
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Alerts API returns 400 for Python [144282691] - Issue Tracker
2. My SA was made through the `Using OAuth 2.0 for Server to Server Applications` documentation provided as further reading to the original...
Read more >FCM api 'Bad request 400' error - Stack Overflow
I'm trying to implement sending notifications via new FCM api protocols. ... Now when I send request I'm receiving Bad request 400 error....
Read more >Relic Solution: How to Use the Infrastructure Alerts REST API ...
Relic Solution: How to Use the Infrastructure Alerts REST API to Its Maximum Potential - Part 2: Compound Alert Conditions.
Read more >Handle API errors | Google Calendar
400 : Bad Request; 401: Invalid Credentials; 403: User Rate Limit Exceeded; 403: Rate Limit ... The Calendar API returns two levels of...
Read more >Solved: 400 error when creating issue via REST API
Foster ,. welcome to the Atlassian community! Please look at the documentation for Jira cloud - create issue section. The correct url is:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have it working! I follow the google person’s comments and added in ‘subject=myemail@mydomain.com’. Small test case that works for me:
Hi! this ended up working for us too - It seems i chose the wrong subject. Thanks!