GithubHelp home page GithubHelp logo

patch-technology / patch-python Goto Github PK

View Code? Open in Web Editor NEW
20.0 20.0 2.0 233 KB

Patch's Python client library - https://www.patch.io

Home Page: https://www.usepatch.com

Makefile 0.07% Python 99.87% Dockerfile 0.07%
carbon carbon-dioxide carbon-emissions carbon-footprint carbon-offsets carbon-offsetting carbon-removal python

patch-python's Issues

Got an unexpected keyword argument 'total_price_cents_usd' to method create_order

Hi there.

I received the following error when using the example python code from docs. I am using the test API keys as the 'ApiClient' and have been able to create orders sucessfully by mass_g. However, when using the create order by price, I am receiving argument errors.

total_price_cents_usd = 500 # Pass in the total price in cents of US dollars (i.e. 5 dollars)
patch.orders.create_order(total_price_cents_usd=total_price_cents_usd)

Results in

ApiTypeError: Got an unexpected keyword argument 'total_price_cents_usd' to method create_order

On looking at the orders_api.py I see there is no total_price_cents_usd, just price_cents_usd. Changing the param label to this results in the following error.

total_price_cents_usd = 500 # Pass in the total price in cents of US dollars (i.e. 5 dollars)
patch.orders.create_order(price_cents_usd=total_price_cents_usd)

Results in...

ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Server': 'nginx/1.17.8', 'Date': 'Tue, 30 Mar 2021 09:57:35 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'X-Frame-Options': 'SAMEORIGIN', 'X-XSS-Protection': '1; mode=block', 'X-Content-Type-Options': 'nosniff', 'X-Download-Options': 'noopen', 'X-Permitted-Cross-Domain-Policies': 'none', 'Referrer-Policy': 'strict-origin-when-cross-origin', 'Vary': 'Accept, Origin', 'Cache-Control': 'no-cache', 'X-Request-Id': '961cb0a64cba5d3835a9b28336dd3455', 'X-Runtime': '0.026914', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Credentials': 'true', 'Access-Control-Allow-Methods': 'GET, PUT, POST, DELETE, PATCH, OPTIONS', 'Access-Control-Allow-Headers': 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization'})
HTTP response body: {"data":null,"error":{"code":422,"message":" must only contain one of: mass_g, total_price_cents_usd"},"meta":null,"success":false}

Thanks in advance.

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.