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

matplotlib issue with plotting lists
Is it possible to combine VPython and Pygame?
django queryset with higher number of count
How can I add two functions together in Python 3?
Why am i getting WindowsError: [Error 5] Access is denied?
pytesseract shows “ 'str' object has no attribute 'save' ” error
django queryset filter with datetime and date
PyQT4: get values from another python module in parallel thread
Is this the proper way to complete a handshake for pyOpenSSL?
Changing output fonts in ipython
TypeError: 'file' object has no attribute '__getitem__'
Data not received by twisted socket connection
python loop dencrementing a variable for every iteration
Histograms: “TypeError, list indices must be integers, not str”
Scipy fmin_slsqp error “failed in converting 8th argument `g' of _slsqp.slsqp to C/Fortran array”
SciPy: n-dimensional interpolation of sparse data

Categories

HOME
python
sql-server-2008
vue.js
elixir
uibutton
bibtex
matplotlib
zend-framework2
apache2
apple-numbers
algorithmic-trading
ext.net
schemacrawler
vsftpd
codeblocks
jframe
shader
local
cosmicmind
cratedb
multiple-monitors
spring-cloud-config
pyephem
primes
cython
multiple-columns
ghost-inspector
remove-method
maximo
version-numbering
frp
cgal
thinking-sphinx
jackson-dataformat-csv
piecewise
oracle-xml-db
getline
ifstream
large-data
jquery-cycle2
vmd
silverlight-3.0
rule
cgo
code-composer
ical-dotnet
knockout-3.0
crop
resuming-training
vcf
ajp
fqdn
chunked-encoding
spell-checking
date-range
garrys-mod
pdfkit
atlassian-crowd
nofollow
database-backups
clob
squirrel
dac
freefem++
django-south
post-processing
yoothemes
fortran90
galaxy
loose-typing
hateoas
drf-nested-routers
java.util.calendar
geodjango
enyo
windowlistener
xjc
digits
crash-dumps
web-component-tester
code-first-migrations
hiera
errorprovider
x-ua-compatible
cg
sthttprequest
yahoo-boss-api
valence
colt
picat
ssms-addin
jquery-tabs
convex-polygon
asp.net-mvc-scaffolding
nimrod
trimming
dynamic-binding
dig
fraud-prevention
pys60
tfs-power-tools
pstree
deploying
wcf-web-api
ninject-extensions
hinstance
nssavepanel
wchar
cross-domain-policy
easygui
printing-web-page
posting
msn
multibyte-functions
kpi
self-reference
associativity

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