amey-sam / flask-mailgun Goto Github PK
View Code? Open in Web Editor NEWFlask MailGun extension
License: MIT License
Flask MailGun extension
License: MIT License
I get an error when attempting to send attachments when running from 7bb76b3 (head of the develop branch).
Sending with attachments does work at dd15a0a.
I'm running Python 3.6.4
. Here's the error I'm getting:
(my code is above this point in the stack)
...
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/src/flask-mailgun3/flask_mailgun/core.py", line 51, in send
08:45:44 web.1 | return self.mailgun_api.send(message)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/src/flask-mailgun3/flask_mailgun/api.py", line 80, in send
08:45:44 web.1 | files=files)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/requests/api.py", line 112, in post
08:45:44 web.1 | return request('post', url, data=data, json=json, **kwargs)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/requests/api.py", line 58, in request
08:45:44 web.1 | return session.request(method=method, url=url, **kwargs)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/requests/sessions.py", line 494, in request
08:45:44 web.1 | prep = self.prepare_request(req)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/requests/sessions.py", line 437, in prepare_request
08:45:44 web.1 | hooks=merge_hooks(request.hooks, self.hooks),
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/requests/models.py", line 308, in prepare
08:45:44 web.1 | self.prepare_body(data, files, json)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/requests/models.py", line 496, in prepare_body
08:45:44 web.1 | (body, content_type) = self._encode_files(files, data)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/requests/models.py", line 162, in _encode_files
08:45:44 web.1 | rf.make_multipart(content_type=ft)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/urllib3/fields.py", line 174, in make_multipart
08:45:44 web.1 | (('name', self._name), ('filename', self._filename))
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/urllib3/fields.py", line 134, in _render_parts
08:45:44 web.1 | parts.append(self._render_part(name, value))
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/urllib3/fields.py", line 114, in _render_part
08:45:44 web.1 | return format_header_param(name, value)
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/urllib3/fields.py", line 35, in format_header_param
08:45:44 web.1 | if not any(ch in value for ch in '"\\\r\n'):
08:45:44 web.1 | File "/Users/aje/git/inqqqq/venv/lib/python3.6/site-packages/urllib3/fields.py", line 35, in <genexpr>
08:45:44 web.1 | if not any(ch in value for ch in '"\\\r\n'):
08:45:44 web.1 | TypeError: a bytes-like object is required, not 'str'
It seems like there are issues around saving attachments in python3 need to investigate
======================================================================
ERROR: test_receive_message (tests.test_receve.ReceiveMessageTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/amey-sam/Flask-MailGun/tests/test_receve.py", line 32, in test_receive_message
response = self.appclient.post('/upload', data=request)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/werkzeug/test.py", line 801, in post
return self.open(*args, **kw)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/flask/testing.py", line 127, in open
follow_redirects=follow_redirects)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/werkzeug/test.py", line 754, in open
environ = args[0].get_environ()
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/werkzeug/test.py", line 552, in get_environ
stream_encode_multipart(values, charset=self.charset)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/werkzeug/test.py", line 98, in stream_encode_multipart
write_binary(chunk)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/werkzeug/test.py", line 59, in write_binary
stream.write(string)
TypeError: a bytes-like object is required, not 'str'
======================================================================
ERROR: test_save_attachments (tests.test_save_attachments.SaveAttachmentTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/travis/build/amey-sam/Flask-MailGun/tests/test_save_attachments.py", line 35, in test_save_attachments
filenames = save_attachments([self.attachment], testdir)
File "/home/travis/build/amey-sam/Flask-MailGun/flask_mailgun/attachment.py", line 52, in save_attachments
attachment.save(filename)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/site-packages/werkzeug/datastructures.py", line 2706, in save
copyfileobj(self.stream, dst, buffer_size)
File "/home/travis/virtualenv/python3.5.2/lib/python3.5/shutil.py", line 76, in copyfileobj
fdst.write(buf)
TypeError: a bytes-like object is required, not 'str'
File REDACTED/venv/src/flask-mailgun3/flask_mailgun/processing.py", line 30
self.async = async_pool(app.config.get('MAILGUN_BG_PROCESSES', 4))
^
SyntaxError: invalid syntax
Seems related to python 3.7 changes. See ansible/ansible#32816.
Writing Flask-MailGun3-0.1.6/setup.cfg
creating dist
Creating tar archive
removing 'Flask-MailGun3-0.1.6' (and everything under it)
/home/travis/virtualenv/pypy2.7-5.10/site-packages/cryptography/hazmat/bindings/openssl/binding.py:163: CryptographyDeprecationWarning: OpenSSL version 1.0.1 is no longer supported by the OpenSSL project, please upgrade. A future version of cryptography will drop support for it.
utils.CryptographyDeprecationWarning
Uploading distributions to https://upload.pypi.org/legacy/
Uploading Flask-MailGun3-0.1.6.tar.gz
100%|##########| 17.9k/17.9k [00:00<00:00, 69.3kB/s]HTTPError: 403 Client Error: Invalid or non-existent authentication information. for url: https://upload.pypi.org/legacy/
NOTE: Try --verbose to see response content.
Flask_MailGun3.egg-info/PKG-INFO already exists, no checkout
Flask_MailGun3.egg-info/SOURCES.txt already exists, no checkout
Flask_MailGun3.egg-info/dependency_links.txt already exists, no checkout
Flask_MailGun3.egg-info/not-zip-safe already exists, no checkout
Flask_MailGun3.egg-info/requires.txt already exists, no checkout
Flask_MailGun3.egg-info/top_level.txt already exists, no checkout
Could not restore untracked files from stash entry
PyPI upload failed.
failed to deploy
Version 1.6 on Pypi does not include the async fix for Python 3.7
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.