dwolla / dwolla-v2-python Goto Github PK
View Code? Open in Web Editor NEWOfficial Python Wrapper for Dwolla's API
Home Page: https://developers.dwolla.com
License: MIT License
Official Python Wrapper for Dwolla's API
Home Page: https://developers.dwolla.com
License: MIT License
When requests timeout
option support will be it added to this library?
Collecting dwollav2
Using cached dwollav2-1.1.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/cg/v9dhxy1x42j_q_zsfgb1blsh0000gn/T/pip-build-0mANaF/dwollav2/setup.py", line 23, in <module>
long_description=open('README.md').read(),
IOError: [Errno 2] No such file or directory: 'README.md'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cg/v9dhxy1x42j_q_zsfgb1blsh0000gn/T/pip-build-0mANaF/dwollav2/
Hello. I work for Astra, one of your clients, and my office is in Brazil.
It seems Cloudfare requires captcha from Brazilian IP addresses.
I asked dwolla support for the whitelist of my IP address a few times, but since it's dynamic, I keep needing to ask over and over again.
Is there a way I could solve the captcha once, and have the dwolla python library read that token/cookie from somewhere?
Please note that I only plan to access to sandbox environment from my IP, and I completely understand if keep being "strict" with IPs outside the USA for the production environment. That said being so strict with the sandbox doesn't make a lot of sense to me.
Add a nonce in the idempotency header for state changing requests to prevent duplicate calls.
When running a long process it appears that the underlying request library throws an error.
token = dwollav2.Client(
key = self.app.config.get('DWOLLA_KEY'),
secret = self.app.config.get('DWOLLA_SECRET'),
environment = self.app.config.get('DWOLLA_ENV')
).Auth.client()
ConnectionError
('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer'))
requests/adapters.py in send at line 490
# Then, reraise so that we can handle the actual exception.
low_conn.close()
raise
except (ProtocolError, socket.error) as err:
raise ConnectionError(err, request=request)
except MaxRetryError as e:
if isinstance(e.reason, ConnectTimeoutError):
# TODO: Remove this in 3.0.0: see #2811
if not isinstance(e.reason, NewConnectionError):
ConnectionResetError
[Errno 104] Connection reset by peer
python3.6/ssl.py in read at line 625
If 'buffer' is provided, read into this buffer and return the number of
bytes read.
"""
if buffer is not None:
v = self._sslobj.read(len, buffer)
else:
v = self._sslobj.read(len)
return v
def write(self, data):
From our logs it appears that the initial handshake makes a call to get an access_token and subsequent calls always create a new HTTPS connection for api.dwolla.com but not for the www.dwollo.com domain.
[DEBUG] Starting new HTTPS connection (1): www.dwolla.com
[DEBUG] https://www.dwolla.com:443 "POST /oauth/v2/token HTTP/1.1" 200 None
[DEBUG] Starting new HTTPS connection (1): api.dwolla.com
[DEBUG] https://www.dwolla.com:443 "POST /oauth/v2/token HTTP/1.1" 200 None
[DEBUG] Starting new HTTPS connection (1): api.dwolla.com
[DEBUG] https://api.dwolla.com:443 "GET /mass-payments/XXXXX/items HTTP/1.1" 200 2331
[DEBUG] https://www.dwolla.com:443 "POST /oauth/v2/token HTTP/1.1" 200 None
[DEBUG] Starting new HTTPS connection (1): api.dwolla.com
[DEBUG] https://api.dwolla.com:443 "GET /transfers/XXXXX HTTP/1.1" 200 1247
Notice there is no subsequent connection made for www.dwolla.com. It appears www.dwolla.com, unlike api.dwolla.com becomes cached by the request library and eventually the connection drops raising an error.
Future logs, after a connection error, show the connection being reestablished as follows. Note (2): www.dwolla.com
. Where (2) is the num of connections made to that host during a process. I've noticed that after every error the connection count increases.
[DEBUG] Starting new HTTPS connection (2): www.dwolla.com
[DEBUG] https://www.dwolla.com:443 "POST /oauth/v2/token HTTP/1.1" 200 None
[DEBUG] Starting new HTTPS connection (1): api.dwolla.com
[DEBUG] https://api.dwolla.com:443 "GET /mass-payments/XXX/items HTTP/1.1" 200
It seems that the issues would resolve if the library did not cache the www.dwolla.com host or a new connection was established per request.
As a work around I've tried to add a try catch block around the token code until I can come up with a better solution but have had mixed results thus far.
Upload of document fails with TypeError in version 1.5.0.
After we reverted back to version 1.3.0 the error went away, and that's the lib we have in prod right now.
We didn't test version 1.4.0 so I don't know if the error would be present in that version
Here's the stacktrace:
TypeError: request() got an unexpected keyword argument 'file'
at post (/base/data/home/apps/s~astra-delta-production-205714/20191114t162658.422449984953391035/lib/requests/sessions.py:581)
at post (/base/data/home/apps/s~astra-delta-production-205714/20191114t162658.422449984953391035/lib/dwollav2/token.py:63)
at upload_document (/base/data/home/apps/s~astra-delta-production-205714/20191114t162658.422449984953391035/transfers/dwolla.py:225)
at send_document_dwolla (/base/data/home/apps/s~astra-delta-production-205714/20191114t162658.422449984953391035/transfers/controllers.py:723)
at send_document_dwolla (/base/data/home/apps/s~astra-delta-production-205714/20191114t162658.422449984953391035/main.py:398)
at invoke_remote_method (/base/alloc/tmpfs/dynamic_runtimes/python27g/7633deef4a2907e3/python27/python27_lib/versions/third_party/protorpc-1.0/protorpc/remote.py:414)
at invoke_remote (/base/data/home/apps/s~astra-delta-production-205714/20191114t162658.422449984953391035/lib/endpoints/api_config.py:1351)
at protorpc_service_app (/base/alloc/tmpfs/dynamic_runtimes/python27g/7633deef4a2907e3/python27/python27_lib/versions/third_party/protorpc-1.0/protorpc/wsgi/service.py:181)
Here's the code we use for the upload:
def upload_document(self, customer_id, fd_file, document_type):
customer_url = "customers/%s" % customer_id
document = self.app_token.post('%s/documents' % customer_url,
file=fd_file,
documentType=document_type)
document_url = document.headers['location']
return document_url
When using Dwolla/Plaid tokenization to create a new funding source, if that token is no longer valide, a generic error happens :
dwollav2.error.Error: {"code":"UpdateCredentials","message":"The login details for this token have changed."}
The Error class is a little bit misleading, it will be easier to isolate this issue if the error was named .error.PlaidError
or TokenError
or even ValidationError like the rest.
The changes slated for 2/11 have not been released for this client.
https://developers.dwolla.com/resources/changelog.html#changing
It appears this might not have been implemented, or am I doing it wrong?
token.post('documents/%s' % id, documentType = 'other', file = ('rollbar.png', open('rollbar.png', 'rb'), 'image/png'))
Results in:
TypeError: <open file 'rollbar.png', mode 'rb' at 0x10c6ea4b0> is not JSON serializable
And
token.post('documents/%s' % id, documentType = 'other', file = ('rollbar.png', open('rollbar.png', 'rb').read(), 'image/png'))
Results in:
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte
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.