2Checkout / 2checkout-python

2Checkout Python Library
MIT License
26 stars 17 forks source link

Suddenly getting json.decoder.JSONDecodeError #14

Open karaburmication opened 3 years ago

karaburmication commented 3 years ago

Suddenly getting this error during authorization request:

File "C:\Users\Nik\AppData\Local\Programs\Python\Python39\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Nik\AppData\Local\Programs\Python\Python39\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I'm using the exact same test code as before:

@blueprint.route('/order', methods=['POST'])
def order():
    # Setup credentials and environment
    twocheckout.Api.auth_credentials({
        'private_key': 'my-private-key',
        'seller_id': 'my-id'
    })
# Setup arguments for authorization request
args = {
    'merchantOrderId': '123',
    'token': request.form["token"],
    'currency': 'USD',
    'total': '1.00',
    'billingAddr': {
        'name': 'Testing Tester',
        'addrLine1': '123 Test St',
        'city': 'Columbus',
        'state': 'OH',
        'zipCode': '43123',
        'country': 'USA',
        'email': 'example@2co.com',
        'phoneNumber': '555-555-5555'
    }
}

# Make authorization request
try:
    result = twocheckout.Charge.authorize(args)
    return result.responseCode
except TwocheckoutError as error:
    return error.msg`

Anyone knows how to resolve it?

Anddr3s commented 2 years ago

I've the same problem, were you able to solve this problem?