Code Monkey home page Code Monkey logo

flask-mailgun's Issues

sending with attachments not working

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'

Python 3 incompattability

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'

python 3.7 issues

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.

issue with pypi deployment

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

FaradayRF/faradayio#35
travis-ci/travis-ci#10056

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.