-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read an OFX String instead of a OFX file #159
Comments
Can you try this: from io import BytesIO
from ofxparse import OfxParser
ofx_string = """OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
(...)
"""
f = BytesIO(ofx_string)
ofx = OfxParser.parse(f)
# Account
account = ofx.account
account.routing_number |
i tried but this TypeError occurs.. TypeError: a bytes-like object is required, not 'str' |
@valinolucas407, try to encode your string, like this: from io import BytesIO
from ofxparse import OfxParser
ofx_string = """OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
(...)
"""
ofx = OfxParser.parse(BytesIO(ofx_string.encode('utf-8')))
account = ofx.account
account.routing_number |
Thanks @leogregianin for explaining this. @valinolucas407, did you get your code to work? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It would be helpful if this library could read an OFX string instead of only OFX files.
The text was updated successfully, but these errors were encountered: