Bug in PaymentRequest class in lib/paymentrequest.py
See original GitHub issueFrom lib/paymentrequest.py at line 187:
class PaymentRequest:
def __init__(self, data, error=None):
self.raw = data
self.error = error
self.parse(data)
self.requestor = None # known after verify
self.tx = None
def __str__(self):
return self.raw
^ self.raw above is sometimes a bytes object. This causes python runtime to throw an exception when doing str(request) on a PaymentRequest object (see #770).
I would like to fix this – (perhaps if isinstance(self.raw, bytes)… bla). Or some other approach.
So… what’s the deal here? Suggestions? Should I just fix it by detecting bytes and encoding to string?
Issue Analytics
- State:
- Created 5 years ago
- Comments:10
Top Results From Across the Web
Google Pay API PaymentRequest Tutorial
Step 1: Create a PaymentDataRequest object · Step 2: Declare Google Pay API support · Putting it all together · Payment method parameter...
Read more >Payment Request API - W3C
The working group maintains a list of all bug reports that the group has not yet addressed. Pull requests with proposed specification text ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Right you are. The paymentrequest.raw field is actually a bunch of google protocol buffer bytes so … the ‘str’ isn’t meaningful. It’s just for debugging. But – you know – might as well fix it since it’s clearly not to spec… even for debugging. 😃
It does make sense that
self.raw
is bytes, but why implement__str__
in the first place? I’m assuming it was just for debugging