yoda-yoda / gmail-api-wrapper Goto Github PK
View Code? Open in Web Editor NEWGmail API Wrapper - A Python Client
Home Page: https://pypi.python.org/pypi/gmail-api-wrapper/
License: Other
Gmail API Wrapper - A Python Client
Home Page: https://pypi.python.org/pypi/gmail-api-wrapper/
License: Other
Hi, I followed the instruction downloading credential file and rename it as "client_secret.json" before putting it into ~/.credentials/ directory. However, Still met a problem when initialize a object from GmailAPIReadWrapper(). Any idea to solve the problem? Thanks.
(Ubuntu 16.0.4)
Python 3.7.0 (default, Jun 28 2018, 13:15:42)
[GCC 7.2.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
from gmail_api_wrapper.crud.read import GmailAPIReadWrapper
gmail_api = GmailAPIReadWrapper()
Traceback (most recent call last):
File "", line 1, in
File "/home/Tai-chunWei/workspace/gmail-api-wrapper/gmail_api_wrapper/crud/read.py", line 75, in init
self.gmail_api = GmailAPIConnection().gmail_api_connect()
File "/home/Tai-chunWei/workspace/gmail-api-wrapper/gmail_api_wrapper/connection.py", line 115, in gmail_api_connect
service = google_api.get_service()
File "/home/Tai-chunWei/workspace/gmail-api-wrapper/gmail_api_wrapper/connection.py", line 97, in get_service
creds = self._get_credentials()
File "/home/Tai-chunWei/workspace/gmail-api-wrapper/gmail_api_wrapper/connection.py", line 83, in _get_credentials
credentials = store.get()
File "/home/Tai-chunWei/anaconda3/lib/python3.7/site-packages/oauth2client/client.py", line 407, in get
return self.locked_get()
File "/home/Tai-chunWei/anaconda3/lib/python3.7/site-packages/oauth2client/file.py", line 54, in locked_get
credentials = client.Credentials.new_from_json(content)
File "/home/Tai-chunWei/anaconda3/lib/python3.7/site-packages/oauth2client/client.py", line 302, in new_from_json
module_name = data['_module']
KeyError: '_module'
environment:
Linux instance-1 4.9.0-6-amd64 #1 SMP Debian 4.9.88-1+deb9u1 (2018-05-07) x86_64 GNU/Linux
pip:
gmail-api-wrapper==0.1.1a2
code:
# -*- coding: utf8 -*-
from gmail_api_wrapper.crud.write import GmailAPIWriteWrapper
api = GmailAPIWriteWrapper()
# compose new mail
import datetime
nowstr = datetime.datetime.strftime(datetime.datetime.now(), "%Y-%m-%d %H%M%S")
subject = "test"
body = nowstr
print api.compose_mail(subject=subject, body=body, to='[email protected]')
error:
Traceback (most recent call last):
File "sendmail.py", line 10, in <module>
print api.compose_mail(subject=subject, body=body, to='[email protected]')
File "/xxxxx/.local/lib/python2.7/site-packages/gmail_api_wrapper/crud/write.py", line 92, in compose_mail
b64_raw = base64.urlsafe_b64encode(message.as_bytes())
AttributeError: MIMEText instance has no attribute 'as_bytes'
You have a README.rst
in this repository, but PyPI uses .md
format with the actual settings, so the result is quite bad.
I did the second test on the read, error:
C:\Anaconda3\python.exe C:/Users/liumin/PycharmProjects/StockA/GmailWrapperRead.py
C:\Anaconda3\lib\site-packages\oauth2client_helpers.py:255: UserWarning: Cannot access C:\Users\name.credentials\gmail-api-wrapper-py.json: No such file or directory
warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
It did open a browser, but still gave me an final error after the above error:
==noauth_local_webserver (it popped up an login page, I login, webpage showed authorization success)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.