私はPythonのためのQuickbooks APIを実装しようとしています、トランザクションに基づいて請求書を生成し、それらを私のquickbooksアカウントに送ります。私はthis APIにアクセスするためのPythonライブラリを使用しています。これは現在バージョン0.5.1にあり、PyPIで利用できます。 Quickbooks Onlineにアプリケーションを接続する際に問題が発生しています。python-quickbooksライブラリとQuickbooks会計APIを使用してヘルプが必要
QuickBookで開発者アカウントを作成し、自分のアプリケーショントークン、コンシューマーキー、コンシューマーシークレットにアクセスできます。図書館のgithubページのガイドは、「あなたのアプリケーションをQuickbooks Onlineに接続する」の下で、ステップ1と2は互いに関連しているように見えますが、互いに独立しているように思えます。主にクライアント変数の再初期化のためです。
クライアントという名前の複数のQuickbookオブジェクトがありますが、コード全体で再初期化するはずですか?
私のコードは次のようになります。私は、エラー何かが間違っている必要がありそうだが、私は混乱しているので
KeyError: 'Decoder failed to handle oauth_token with data as returned by provider. A different decoder may be needed. Provider returned: oauth_problem=parameter_absent&oauth_parameters_absent=oauth_verifier'
:このコードで
def create_invoice():
consumer_key = 'MY-CONSUMER-KEY'
consumer_secret = 'MY-CONSUMER-SECRET'
client = QuickBooks(
sandbox=True,
consumer_key=consumer_key,
consumer_secret=consumer_secret,
callback_url='https://sandbox-quickbooks.api.intuit.com',
)
authorize_url = client.get_authorize_url()
request_token = client.request_token
request_token_secret = client.request_token_secret
client = QuickBooks(
sandbox=True,
consumer_key=consumer_key,
consumer_secret=consumer_secret
)
client.authorize_url = authorize_url
client.request_token = request_token
client.request_token_secret = request_token_secret
client.set_up_service()
client.get_access_tokens(request.vars.oauth_verifier)
realm_id = request.vars.realmId
access_token = client.access_token
access_token_secret = client.access_token_secret
client = QuickBooks(
sandbox=True,
consumer_key=consumer_key,
consumer_secret=consumer_secret,
access_token=access_token,
access_token_secret=access_token_secret,
company_id=realm_id
)
invoice = Invoice()
line = SalesItemLine()
line.LineNum = 1
line.Description = "description"
line.Amount = 100
line.SalesItemLineDetail = SalesItemLineDetail()
item = Item.all(max_results=1, qb=client)[0]
line.SalesItemLineDetail.ItemRef = item.to_ref()
invoice.Line.append(line)
customer = Customer.all(max_results=1, qb=client)[0]
invoice.CustomerRef = customer.to_ref()
invoice.CustomerMemo = CustomerMemo()
invoice.CustomerMemo.value = "Customer Memo"
invoice.save(qb=client)
私はエラーを取得しますどこに行くの?