UPDATE: Please, if anyone can help: Google is waiting for inputs and examples of this problem on their bug tracking tool. If you have reproducible steps for this issue, please share them on: https://code.google.com/p/googleappengine/issues/detail?id=10937
I'm trying to fetch data from the StackExchange API using a Google App Engine backend. As you may know, some of StackExchange's APIs are site-specific, requiring developers to run queries against every site the user is registered in.
So, here's my backend code for fetching timeline data from these sites. The feed_info_site
variable holds the StackExchange site name (such as 'security'
, 'serverfault'
, etc.).
data = json.loads(urllib.urlopen("%sme/timeline?%s" % (self.API_BASE_URL, urllib.urlencode({"pagesize": 100, "fromdate": se_since_timestamp, "filter": "!9WWBR (nmw", "site": feed_info_site, "access_token": decrypt(self.API_ACCESS_TOKEN_SECRET, self.access_token), "key": self.API_APP_KEY}))).read()) for item in data['items']: ... # code for parsing timeline items
When running this query on all sites except Stack Overflow, everything works OK. What's weird is, when the feed_info_site
variable is set to 'stackoverflow'
, I get the following error from Google App Engine:
HTTPException: Invalid and/or missing SSL certificate for URL: https://api.stackexchange.com/2.2/me/timeline? filter=%219WWBR%28nmw&access_token= <ACCESS_TOKEN_REMOVED>&fromdate=1&pagesize=100&key= <API_KEY_REMOVED>&site=stackoverflow
Of course, if I run the same query in Safari, I get the JSON results I'm expecting from the API. So the problem really lies in Google's URLfetch service. I found several topics here on Stack Overflow related to similar HTTPS/SSL exceptions, but no accepted answer solved my problems. I tried removing cacerts.txt
files. I also tried making the call with validate_certificate=False
, with no success.
I think the problem is not strictly related to HTTPS/SSL. If so, how would you explain that changing a single API parameter would make the request to fail?
Log into the Google Admin console. Go to Security > Advanced Settings > Show More (optional) > SSL for Custom Domains. Select Configure SSL Certificates to go to SSL configuration page. Now click on Upload a new certificate button.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With