python


SSLHandshakeError when connecting to Google Analytics using Google APIs Client Library for Python


I'm trying to connect to Google Analytics using a Service Account, but I get the following error:
SSLHandshakeError at ...
[Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
I have PyOpenSSL and PyCrypto installed and updated.
Here's the code I use to connect:
from oauth2client.client import SignedJwtAssertionCredentials
from apiclient.discovery import build
import httplib2
def initialize_service():
f = open('path_to_key_file.p12', 'rb')
key = f.read()
f.close()
credentials = SignedJwtAssertionCredentials('XXXX#developer.gserviceaccount.com', key, scope='https://www.googleapis.com/auth/analytics.readonly')
http = httplib2.Http()
http = credentials.authorize(http)
print 'This is printed'
service = build('analytics', 'v3', http=http)
print 'This is not printed'
return service
It seems that the problem occurred because the system clock wasn't set to the current time.

Related Links

Print from keyword to end of sequence when sequence is multiple lines
select() on socket and another event mechanism
I try to create a GUI in python to read a file and write a new file but the syntax error shows up
URL common name matching - Python
Odd digit count python
how to post in facebook group that's im member on it using facebook-sdk python
How to chunk up an interval in Python?
How to merge multiple dictionaries
Ubuntu does not find module directory containing __init__.py
How to detect frequencies with matplotlib spectrogram?
Python timeout decorator
boto3 changing AWS ec2 instance state
Inputing date using Selenium/Python does not work
Opening IDLE from Terminal
IP proto field number to string
Setting all dictionary elements to 0 python

Categories

HOME
sql-server-2008
jdbc
openssl
xamarin.android
textwatcher
bower
memory-leaks
command
windows-store-apps
angular2-directives
is-empty
eval
dropbox
flann
informatica-powercenter
cpanel
simple-injector
phoenix
line-api
flat-file
styles
tweets
tcpclient
remove-method
profile
searchbar
yosys
metis
mef2
unpack
cgal
helper
cortex-m3
pygooglechart
jboss5.x
crt
svnkit
stocks
socketpair
axis-labels
twiki
powermta
lumen-5.3
chown
tcserver
httplib2
spyne
barcode-printing
cjson
update-site
ng2-material
squirrel
freefem++
django-south
fortran90
acm
file-diffs
app.xaml
selendroid
paypal-nvp
visual-studio-code
built-in
vine
calibration
rx-groovy
graphical-logo
cpu-cores
virus
consensus
python-ggplot
alphablending
kendo-mvvm
snmp4j
korma
picat
phpdocx
joox
ksoap2
edit-in-place
sqljdbc
bignum
asp.net-mvc-scaffolding
javascriptmvc
gridworld
vmware-server
fraud-prevention
fortran77
objcmongodb
arbor.js
abnf
pitch
datarepeater
scrollto
die
.app
exitstatus
surefire
clients
filetime
project-lifecycle
self-reference
divx

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App