Skip to content
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

Unable to proceed with TypeError: update_token() argument after ** must be a mapping, not str #72

Open
bishwadeep opened this issue Dec 19, 2021 · 0 comments
Assignees

Comments

@bishwadeep
Copy link

Hey guys,
I need help as I am not able to resolve this issue for so long. Now I am stuck in the last function, Any help would be really appreciated. I used the code from here: XeroAPI/xero-python-custom-connections-starter#1 to get the tocken.
``
Traceback (most recent call last):
File "", line 1, in
File "/code/providers/xero_invoice.py", line 308, in invoiceGetActiveProviders
results = accounting_api.create_invoices(xero_tenant_id, invoice, True)
File "/usr/local/lib/python3.7/site-packages/xero_python/accounting/api/accounting_api.py", line 2493, in create_invoices
collection_formats=collection_formats,
File "/usr/local/lib/python3.7/site-packages/xero_python/api_client/init.py", line 365, in call_api
_request_timeout,
File "/usr/local/lib/python3.7/site-packages/xero_python/api_client/init.py", line 186, in __call_api
self.update_params_for_auth(header_params, query_params, auth_settings)
File "/usr/local/lib/python3.7/site-packages/xero_python/api_client/init.py", line 579, in update_params_for_auth
auth_setting = auth_setting(api_client=self)
File "/usr/local/lib/python3.7/site-packages/xero_python/api_client/oauth2.py", line 176, in create_auth_settings
self.update_token(**api_client.get_oauth2_token())
TypeError: update_token() argument after ** must be a mapping, not str

Here is the code:
I have a custom connection setup in the xero. I have setup the app and collected the client id and client secret. I have a cron job file which push the invoice. So, I dont want to use flask. I am able to get the token. The error is when I run accounting_api.create_invoices(xero_tenant_id, invoice, True)
``
def invoiceGetActiveProviders():
xero_tenant_id = "Replaced by my tenant id"
xero_client = ApiClient(
Configuration(
debug=False,
oauth2_token=OAuth2Token(
client_id="REPLACED BY CLIENT ID WORKING FINE", client_secret="REPLACED BY SECRET WORKING FINE"
),
),
pool_threads=1,
)
accounting_api = AccountingApi(xero_client)
#my oauth v1 code to create invoice
invoice = '[{'Type': 'ACCREC', 'Contact': {'ContactID': 'REPLACED BY CONTACT ID'}, 'Date': datetime.datetime(2021, 12, 1, 18, 50, 52, 587675), 'DateString': '2021-11-30 18:50:52', 'Reference': 'Nov 2021 Leads', 'DueDate': datetime.datetime(2022, 1, 2, 18, 50, 52, 587668), 'DueDateString': '2022-01-02 18:50:52', 'CurrencyCode': 'AUD', 'LineItems': [{'Description': 'CareerFAQs.com.au AUS Lead', 'Quantity': 1, 'UnitAmount': 65.0, 'AccountCode': '41000', 'ItemCode': '1060'}]}]'

accounting_api.create_invoices(xero_tenant_id, invoice, True)
``

@RettBehrens RettBehrens self-assigned this Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants