You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every call I make works except the one for place trade. I am using the old jupyter notebook has anything changed about how I should execute the auth or how I should make that call? The error is in line with what you say it would be but I cannot get any valuable feedback. What object should I be looking at to determine why the call failed?
I posted the same exact trade on the developer.tdameritrade.com website and it worked.
{
"name": "TypeError",
"message": "Object of type Order is not JSON serializable",
"stack": "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)\n\u001b[1;32mc:\dev\tosProj\Trade2.ipynb Cell 14\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m response \u001b[39m=\u001b[39m td_client\u001b[39m.\u001b[39;49mplaceOrder(account_id, order)\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\tdameritrade\client.py:546\u001b[0m, in \u001b[0;36mTDClient.placeOrder\u001b[1;34m(self, accountId, order)\u001b[0m\n\u001b[0;32m 539\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mplaceOrder\u001b[39m(\u001b[39mself\u001b[39m, accountId, order):\n\u001b[0;32m 540\u001b[0m \u001b[39m"""place an order\u001b[39;00m\n\u001b[0;32m 541\u001b[0m \n\u001b[0;32m 542\u001b[0m \u001b[39m Args:\u001b[39;00m\n\u001b[0;32m 543\u001b[0m \u001b[39m accountId (int): id of account to place order under\u001b[39;00m\n\u001b[0;32m 544\u001b[0m \u001b[39m order (JSON): order instance to place\u001b[39;00m\n\u001b[0;32m 545\u001b[0m \u001b[39m """\u001b[39;00m\n\u001b[1;32m--> 546\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_request(\n\u001b[0;32m 547\u001b[0m PLACE_ORDER\u001b[39m.\u001b[39;49mformat(accountId\u001b[39m=\u001b[39;49maccountId), method\u001b[39m=\u001b[39;49m\u001b[39m"\u001b[39;49m\u001b[39mPOST\u001b[39;49m\u001b[39m"\u001b[39;49m, json\u001b[39m=\u001b[39;49morder\n\u001b[0;32m 548\u001b[0m )\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\tdameritrade\client.py:85\u001b[0m, in \u001b[0;36mTDClient._request\u001b[1;34m(self, url, method, params, args, kwargs)\u001b[0m\n\u001b[0;32m 84\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_request\u001b[39m(\u001b[39mself\u001b[39m, url, method\u001b[39m=\u001b[39m\u001b[39m"\u001b[39m\u001b[39mGET\u001b[39m\u001b[39m"\u001b[39m, params\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, \u001b[39m\u001b[39margs, \u001b[39m\u001b[39m\u001b[39m\u001b[39mkwargs):\n\u001b[1;32m---> 85\u001b[0m resp \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39msession\u001b[39m.\u001b[39mrequest(method, url, params\u001b[39m=\u001b[39mparams, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[0;32m 86\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m response_is_valid(resp):\n\u001b[0;32m 87\u001b[0m handle_error_response(resp)\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\tdameritrade\session.py:23\u001b[0m, in \u001b[0;36mTDASession.request\u001b[1;34m(self, args, kwargs)\u001b[0m\n\u001b[0;32m 21\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mrequest\u001b[39m(\u001b[39mself\u001b[39m, \u001b[39m\u001b[39margs, \u001b[39m\u001b[39m\u001b[39m\u001b[39mkwargs):\n\u001b[0;32m 22\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_refresh_token_if_invalid()\n\u001b[1;32m---> 23\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39mrequest(headers\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_headers, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\sessions.py:573\u001b[0m, in \u001b[0;36mSession.request\u001b[1;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[0;32m 560\u001b[0m \u001b[39m# Create the Request.\u001b[39;00m\n\u001b[0;32m 561\u001b[0m req \u001b[39m=\u001b[39m Request(\n\u001b[0;32m 562\u001b[0m method\u001b[39m=\u001b[39mmethod\u001b[39m.\u001b[39mupper(),\n\u001b[0;32m 563\u001b[0m url\u001b[39m=\u001b[39murl,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 571\u001b[0m hooks\u001b[39m=\u001b[39mhooks,\n\u001b[0;32m 572\u001b[0m )\n\u001b[1;32m--> 573\u001b[0m prep \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mprepare_request(req)\n\u001b[0;32m 575\u001b[0m proxies \u001b[39m=\u001b[39m proxies \u001b[39mor\u001b[39;00m {}\n\u001b[0;32m 577\u001b[0m settings \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mmerge_environment_settings(\n\u001b[0;32m 578\u001b[0m prep\u001b[39m.\u001b[39murl, proxies, stream, verify, cert\n\u001b[0;32m 579\u001b[0m )\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\sessions.py:484\u001b[0m, in \u001b[0;36mSession.prepare_request\u001b[1;34m(self, request)\u001b[0m\n\u001b[0;32m 481\u001b[0m auth \u001b[39m=\u001b[39m get_netrc_auth(request\u001b[39m.\u001b[39murl)\n\u001b[0;32m 483\u001b[0m p \u001b[39m=\u001b[39m PreparedRequest()\n\u001b[1;32m--> 484\u001b[0m p\u001b[39m.\u001b[39;49mprepare(\n\u001b[0;32m 485\u001b[0m method\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mmethod\u001b[39m.\u001b[39;49mupper(),\n\u001b[0;32m 486\u001b[0m url\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49murl,\n\u001b[0;32m 487\u001b[0m files\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mfiles,\n\u001b[0;32m 488\u001b[0m data\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mdata,\n\u001b[0;32m 489\u001b[0m json\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mjson,\n\u001b[0;32m 490\u001b[0m headers\u001b[39m=\u001b[39;49mmerge_setting(\n\u001b[0;32m 491\u001b[0m request\u001b[39m.\u001b[39;49mheaders, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mheaders, dict_class\u001b[39m=\u001b[39;49mCaseInsensitiveDict\n\u001b[0;32m 492\u001b[0m ),\n\u001b[0;32m 493\u001b[0m params\u001b[39m=\u001b[39;49mmerge_setting(request\u001b[39m.\u001b[39;49mparams, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mparams),\n\u001b[0;32m 494\u001b[0m auth\u001b[39m=\u001b[39;49mmerge_setting(auth, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mauth),\n\u001b[0;32m 495\u001b[0m cookies\u001b[39m=\u001b[39;49mmerged_cookies,\n\u001b[0;32m 496\u001b[0m hooks\u001b[39m=\u001b[39;49mmerge_hooks(request\u001b[39m.\u001b[39;49mhooks, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mhooks),\n\u001b[0;32m 497\u001b[0m )\n\u001b[0;32m 498\u001b[0m \u001b[39mreturn\u001b[39;00m p\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\models.py:371\u001b[0m, in \u001b[0;36mPreparedRequest.prepare\u001b[1;34m(self, method, url, headers, files, data, params, auth, cookies, hooks, json)\u001b[0m\n\u001b[0;32m 369\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mprepare_headers(headers)\n\u001b[0;32m 370\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mprepare_cookies(cookies)\n\u001b[1;32m--> 371\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mprepare_body(data, files, json)\n\u001b[0;32m 372\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mprepare_auth(auth, url)\n\u001b[0;32m 374\u001b[0m \u001b[39m# Note that prepare_auth must be last to enable authentication schemes\u001b[39;00m\n\u001b[0;32m 375\u001b[0m \u001b[39m# such as OAuth to work on a fully prepared request.\u001b[39;00m\n\u001b[0;32m 376\u001b[0m \n\u001b[0;32m 377\u001b[0m \u001b[39m# This MUST go after prepare_auth. Authenticators could add a hook\u001b[39;00m\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\models.py:511\u001b[0m, in \u001b[0;36mPreparedRequest.prepare_body\u001b[1;34m(self, data, files, json)\u001b[0m\n\u001b[0;32m 508\u001b[0m content_type \u001b[39m=\u001b[39m \u001b[39m"\u001b[39m\u001b[39mapplication/json\u001b[39m\u001b[39m"\u001b[39m\n\u001b[0;32m 510\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[1;32m--> 511\u001b[0m body \u001b[39m=\u001b[39m complexjson\u001b[39m.\u001b[39;49mdumps(json, allow_nan\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m)\n\u001b[0;32m 512\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mValueError\u001b[39;00m \u001b[39mas\u001b[39;00m ve:\n\u001b[0;32m 513\u001b[0m \u001b[39mraise\u001b[39;00m InvalidJSONError(ve, request\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\init.py:238\u001b[0m, in \u001b[0;36mdumps\u001b[1;34m(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, kw)\u001b[0m\n\u001b[0;32m 232\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mcls\u001b[39m \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 233\u001b[0m \u001b[39mcls\u001b[39m \u001b[39m=\u001b[39m JSONEncoder\n\u001b[0;32m 234\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mcls\u001b[39;49m(\n\u001b[0;32m 235\u001b[0m skipkeys\u001b[39m=\u001b[39;49mskipkeys, ensure_ascii\u001b[39m=\u001b[39;49mensure_ascii,\n\u001b[0;32m 236\u001b[0m check_circular\u001b[39m=\u001b[39;49mcheck_circular, allow_nan\u001b[39m=\u001b[39;49mallow_nan, indent\u001b[39m=\u001b[39;49mindent,\n\u001b[0;32m 237\u001b[0m separators\u001b[39m=\u001b[39;49mseparators, default\u001b[39m=\u001b[39;49mdefault, sort_keys\u001b[39m=\u001b[39;49msort_keys,\n\u001b[1;32m--> 238\u001b[0m \u001b[39m\u001b[39;49m\u001b[39m\u001b[39;49mkw)\u001b[39m.\u001b[39;49mencode(obj)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\encoder.py:199\u001b[0m, in \u001b[0;36mJSONEncoder.encode\u001b[1;34m(self, o)\u001b[0m\n\u001b[0;32m 195\u001b[0m \u001b[39mreturn\u001b[39;00m encode_basestring(o)\n\u001b[0;32m 196\u001b[0m \u001b[39m# This doesn't pass the iterator directly to ''.join() because the\u001b[39;00m\n\u001b[0;32m 197\u001b[0m \u001b[39m# exceptions aren't as detailed. The list call should be roughly\u001b[39;00m\n\u001b[0;32m 198\u001b[0m \u001b[39m# equivalent to the PySequence_Fast that ''.join() would do.\u001b[39;00m\n\u001b[1;32m--> 199\u001b[0m chunks \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49miterencode(o, _one_shot\u001b[39m=\u001b[39;49m\u001b[39mTrue\u001b[39;49;00m)\n\u001b[0;32m 200\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39misinstance\u001b[39m(chunks, (\u001b[39mlist\u001b[39m, \u001b[39mtuple\u001b[39m)):\n\u001b[0;32m 201\u001b[0m chunks \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m(chunks)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\encoder.py:257\u001b[0m, in \u001b[0;36mJSONEncoder.iterencode\u001b[1;34m(self, o, _one_shot)\u001b[0m\n\u001b[0;32m 252\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m 253\u001b[0m _iterencode \u001b[39m=\u001b[39m make_iterencode(\n\u001b[0;32m 254\u001b[0m markers, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdefault, encoder, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mindent, floatstr,\n\u001b[0;32m 255\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mkey_separator, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mitem_separator, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39msort_keys,\n\u001b[0;32m 256\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mskipkeys, one_shot)\n\u001b[1;32m--> 257\u001b[0m \u001b[39mreturn\u001b[39;00m iterencode(o, \u001b[39m0\u001b[39;49m)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\encoder.py:179\u001b[0m, in \u001b[0;36mJSONEncoder.default\u001b[1;34m(self, o)\u001b[0m\n\u001b[0;32m 160\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mdefault\u001b[39m(\u001b[39mself\u001b[39m, o):\n\u001b[0;32m 161\u001b[0m \u001b[39m"""Implement this method in a subclass such that it returns\u001b[39;00m\n\u001b[0;32m 162\u001b[0m \u001b[39m a serializable object for o, or calls the base implementation\u001b[39;00m\n\u001b[0;32m 163\u001b[0m \u001b[39m (to raise a TypeError).\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 177\u001b[0m \n\u001b[0;32m 178\u001b[0m \u001b[39m """\u001b[39;00m\n\u001b[1;32m--> 179\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39mObject of type \u001b[39m\u001b[39m{\u001b[39;00mo\u001b[39m.\u001b[39m\u001b[39m__class\u001b[39m\u001b[39m.\u001b[39m\u001b[39m__name\u001b[39m\u001b[39m}\u001b[39;00m\u001b[39m \u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m 180\u001b[0m \u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39mis not JSON serializable\u001b[39m\u001b[39m'\u001b[39m)\n\n\u001b[1;31mTypeError\u001b[0m: Object of type Order is not JSON serializable"
}
The text was updated successfully, but these errors were encountered:
CoachDaniel
changed the title
ValidationError: 400: A validation error occurred while processing the request.
JSON Serializable error but trade doesn't go through.
Aug 2, 2022
Every call I make works except the one for place trade. I am using the old jupyter notebook has anything changed about how I should execute the auth or how I should make that call? The error is in line with what you say it would be but I cannot get any valuable feedback. What object should I be looking at to determine why the call failed?
I posted the same exact trade on the developer.tdameritrade.com website and it worked.
{
"name": "TypeError",
"message": "Object of type Order is not JSON serializable",
"stack": "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m\n\u001b[1;31mTypeError\u001b[0m Traceback (most recent call last)\n\u001b[1;32mc:\dev\tosProj\Trade2.ipynb Cell 14\u001b[0m in \u001b[0;36m<cell line: 1>\u001b[1;34m()\u001b[0m\n\u001b[1;32m----> 1\u001b[0m response \u001b[39m=\u001b[39m td_client\u001b[39m.\u001b[39;49mplaceOrder(account_id, order)\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\tdameritrade\client.py:546\u001b[0m, in \u001b[0;36mTDClient.placeOrder\u001b[1;34m(self, accountId, order)\u001b[0m\n\u001b[0;32m 539\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mplaceOrder\u001b[39m(\u001b[39mself\u001b[39m, accountId, order):\n\u001b[0;32m 540\u001b[0m \u001b[39m"""place an order\u001b[39;00m\n\u001b[0;32m 541\u001b[0m \n\u001b[0;32m 542\u001b[0m \u001b[39m Args:\u001b[39;00m\n\u001b[0;32m 543\u001b[0m \u001b[39m accountId (int): id of account to place order under\u001b[39;00m\n\u001b[0;32m 544\u001b[0m \u001b[39m order (JSON): order instance to place\u001b[39;00m\n\u001b[0;32m 545\u001b[0m \u001b[39m """\u001b[39;00m\n\u001b[1;32m--> 546\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_request(\n\u001b[0;32m 547\u001b[0m PLACE_ORDER\u001b[39m.\u001b[39;49mformat(accountId\u001b[39m=\u001b[39;49maccountId), method\u001b[39m=\u001b[39;49m\u001b[39m"\u001b[39;49m\u001b[39mPOST\u001b[39;49m\u001b[39m"\u001b[39;49m, json\u001b[39m=\u001b[39;49morder\n\u001b[0;32m 548\u001b[0m )\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\tdameritrade\client.py:85\u001b[0m, in \u001b[0;36mTDClient._request\u001b[1;34m(self, url, method, params, args, kwargs)\u001b[0m\n\u001b[0;32m 84\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39m_request\u001b[39m(\u001b[39mself\u001b[39m, url, method\u001b[39m=\u001b[39m\u001b[39m"\u001b[39m\u001b[39mGET\u001b[39m\u001b[39m"\u001b[39m, params\u001b[39m=\u001b[39m\u001b[39mNone\u001b[39;00m, \u001b[39m\u001b[39margs, \u001b[39m\u001b[39m\u001b[39m\u001b[39mkwargs):\n\u001b[1;32m---> 85\u001b[0m resp \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39msession\u001b[39m.\u001b[39mrequest(method, url, params\u001b[39m=\u001b[39mparams, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\u001b[0;32m 86\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m response_is_valid(resp):\n\u001b[0;32m 87\u001b[0m handle_error_response(resp)\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\tdameritrade\session.py:23\u001b[0m, in \u001b[0;36mTDASession.request\u001b[1;34m(self, args, kwargs)\u001b[0m\n\u001b[0;32m 21\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mrequest\u001b[39m(\u001b[39mself\u001b[39m, \u001b[39m\u001b[39margs, \u001b[39m\u001b[39m\u001b[39m\u001b[39mkwargs):\n\u001b[0;32m 22\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_refresh_token_if_invalid()\n\u001b[1;32m---> 23\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39msuper\u001b[39m()\u001b[39m.\u001b[39mrequest(headers\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_headers, \u001b[39m*\u001b[39margs, \u001b[39m*\u001b[39m\u001b[39m*\u001b[39mkwargs)\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\sessions.py:573\u001b[0m, in \u001b[0;36mSession.request\u001b[1;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[0;32m 560\u001b[0m \u001b[39m# Create the Request.\u001b[39;00m\n\u001b[0;32m 561\u001b[0m req \u001b[39m=\u001b[39m Request(\n\u001b[0;32m 562\u001b[0m method\u001b[39m=\u001b[39mmethod\u001b[39m.\u001b[39mupper(),\n\u001b[0;32m 563\u001b[0m url\u001b[39m=\u001b[39murl,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 571\u001b[0m hooks\u001b[39m=\u001b[39mhooks,\n\u001b[0;32m 572\u001b[0m )\n\u001b[1;32m--> 573\u001b[0m prep \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mprepare_request(req)\n\u001b[0;32m 575\u001b[0m proxies \u001b[39m=\u001b[39m proxies \u001b[39mor\u001b[39;00m {}\n\u001b[0;32m 577\u001b[0m settings \u001b[39m=\u001b[39m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mmerge_environment_settings(\n\u001b[0;32m 578\u001b[0m prep\u001b[39m.\u001b[39murl, proxies, stream, verify, cert\n\u001b[0;32m 579\u001b[0m )\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\sessions.py:484\u001b[0m, in \u001b[0;36mSession.prepare_request\u001b[1;34m(self, request)\u001b[0m\n\u001b[0;32m 481\u001b[0m auth \u001b[39m=\u001b[39m get_netrc_auth(request\u001b[39m.\u001b[39murl)\n\u001b[0;32m 483\u001b[0m p \u001b[39m=\u001b[39m PreparedRequest()\n\u001b[1;32m--> 484\u001b[0m p\u001b[39m.\u001b[39;49mprepare(\n\u001b[0;32m 485\u001b[0m method\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mmethod\u001b[39m.\u001b[39;49mupper(),\n\u001b[0;32m 486\u001b[0m url\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49murl,\n\u001b[0;32m 487\u001b[0m files\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mfiles,\n\u001b[0;32m 488\u001b[0m data\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mdata,\n\u001b[0;32m 489\u001b[0m json\u001b[39m=\u001b[39;49mrequest\u001b[39m.\u001b[39;49mjson,\n\u001b[0;32m 490\u001b[0m headers\u001b[39m=\u001b[39;49mmerge_setting(\n\u001b[0;32m 491\u001b[0m request\u001b[39m.\u001b[39;49mheaders, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mheaders, dict_class\u001b[39m=\u001b[39;49mCaseInsensitiveDict\n\u001b[0;32m 492\u001b[0m ),\n\u001b[0;32m 493\u001b[0m params\u001b[39m=\u001b[39;49mmerge_setting(request\u001b[39m.\u001b[39;49mparams, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mparams),\n\u001b[0;32m 494\u001b[0m auth\u001b[39m=\u001b[39;49mmerge_setting(auth, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mauth),\n\u001b[0;32m 495\u001b[0m cookies\u001b[39m=\u001b[39;49mmerged_cookies,\n\u001b[0;32m 496\u001b[0m hooks\u001b[39m=\u001b[39;49mmerge_hooks(request\u001b[39m.\u001b[39;49mhooks, \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mhooks),\n\u001b[0;32m 497\u001b[0m )\n\u001b[0;32m 498\u001b[0m \u001b[39mreturn\u001b[39;00m p\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\models.py:371\u001b[0m, in \u001b[0;36mPreparedRequest.prepare\u001b[1;34m(self, method, url, headers, files, data, params, auth, cookies, hooks, json)\u001b[0m\n\u001b[0;32m 369\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mprepare_headers(headers)\n\u001b[0;32m 370\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mprepare_cookies(cookies)\n\u001b[1;32m--> 371\u001b[0m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mprepare_body(data, files, json)\n\u001b[0;32m 372\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mprepare_auth(auth, url)\n\u001b[0;32m 374\u001b[0m \u001b[39m# Note that prepare_auth must be last to enable authentication schemes\u001b[39;00m\n\u001b[0;32m 375\u001b[0m \u001b[39m# such as OAuth to work on a fully prepared request.\u001b[39;00m\n\u001b[0;32m 376\u001b[0m \n\u001b[0;32m 377\u001b[0m \u001b[39m# This MUST go after prepare_auth. Authenticators could add a hook\u001b[39;00m\n\nFile \u001b[1;32mc:\dev\tosEnv\lib\site-packages\requests\models.py:511\u001b[0m, in \u001b[0;36mPreparedRequest.prepare_body\u001b[1;34m(self, data, files, json)\u001b[0m\n\u001b[0;32m 508\u001b[0m content_type \u001b[39m=\u001b[39m \u001b[39m"\u001b[39m\u001b[39mapplication/json\u001b[39m\u001b[39m"\u001b[39m\n\u001b[0;32m 510\u001b[0m \u001b[39mtry\u001b[39;00m:\n\u001b[1;32m--> 511\u001b[0m body \u001b[39m=\u001b[39m complexjson\u001b[39m.\u001b[39;49mdumps(json, allow_nan\u001b[39m=\u001b[39;49m\u001b[39mFalse\u001b[39;49;00m)\n\u001b[0;32m 512\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mValueError\u001b[39;00m \u001b[39mas\u001b[39;00m ve:\n\u001b[0;32m 513\u001b[0m \u001b[39mraise\u001b[39;00m InvalidJSONError(ve, request\u001b[39m=\u001b[39m\u001b[39mself\u001b[39m)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\init.py:238\u001b[0m, in \u001b[0;36mdumps\u001b[1;34m(obj, skipkeys, ensure_ascii, check_circular, allow_nan, cls, indent, separators, default, sort_keys, kw)\u001b[0m\n\u001b[0;32m 232\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mcls\u001b[39m \u001b[39mis\u001b[39;00m \u001b[39mNone\u001b[39;00m:\n\u001b[0;32m 233\u001b[0m \u001b[39mcls\u001b[39m \u001b[39m=\u001b[39m JSONEncoder\n\u001b[0;32m 234\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mcls\u001b[39;49m(\n\u001b[0;32m 235\u001b[0m skipkeys\u001b[39m=\u001b[39;49mskipkeys, ensure_ascii\u001b[39m=\u001b[39;49mensure_ascii,\n\u001b[0;32m 236\u001b[0m check_circular\u001b[39m=\u001b[39;49mcheck_circular, allow_nan\u001b[39m=\u001b[39;49mallow_nan, indent\u001b[39m=\u001b[39;49mindent,\n\u001b[0;32m 237\u001b[0m separators\u001b[39m=\u001b[39;49mseparators, default\u001b[39m=\u001b[39;49mdefault, sort_keys\u001b[39m=\u001b[39;49msort_keys,\n\u001b[1;32m--> 238\u001b[0m \u001b[39m\u001b[39;49m\u001b[39m\u001b[39;49mkw)\u001b[39m.\u001b[39;49mencode(obj)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\encoder.py:199\u001b[0m, in \u001b[0;36mJSONEncoder.encode\u001b[1;34m(self, o)\u001b[0m\n\u001b[0;32m 195\u001b[0m \u001b[39mreturn\u001b[39;00m encode_basestring(o)\n\u001b[0;32m 196\u001b[0m \u001b[39m# This doesn't pass the iterator directly to ''.join() because the\u001b[39;00m\n\u001b[0;32m 197\u001b[0m \u001b[39m# exceptions aren't as detailed. The list call should be roughly\u001b[39;00m\n\u001b[0;32m 198\u001b[0m \u001b[39m# equivalent to the PySequence_Fast that ''.join() would do.\u001b[39;00m\n\u001b[1;32m--> 199\u001b[0m chunks \u001b[39m=\u001b[39m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49miterencode(o, _one_shot\u001b[39m=\u001b[39;49m\u001b[39mTrue\u001b[39;49;00m)\n\u001b[0;32m 200\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39misinstance\u001b[39m(chunks, (\u001b[39mlist\u001b[39m, \u001b[39mtuple\u001b[39m)):\n\u001b[0;32m 201\u001b[0m chunks \u001b[39m=\u001b[39m \u001b[39mlist\u001b[39m(chunks)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\encoder.py:257\u001b[0m, in \u001b[0;36mJSONEncoder.iterencode\u001b[1;34m(self, o, _one_shot)\u001b[0m\n\u001b[0;32m 252\u001b[0m \u001b[39melse\u001b[39;00m:\n\u001b[0;32m 253\u001b[0m _iterencode \u001b[39m=\u001b[39m make_iterencode(\n\u001b[0;32m 254\u001b[0m markers, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mdefault, encoder, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mindent, floatstr,\n\u001b[0;32m 255\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mkey_separator, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mitem_separator, \u001b[39mself\u001b[39m\u001b[39m.\u001b[39msort_keys,\n\u001b[0;32m 256\u001b[0m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39mskipkeys, one_shot)\n\u001b[1;32m--> 257\u001b[0m \u001b[39mreturn\u001b[39;00m iterencode(o, \u001b[39m0\u001b[39;49m)\n\nFile \u001b[1;32m~\AppData\Local\Programs\Python\Python310\lib\json\encoder.py:179\u001b[0m, in \u001b[0;36mJSONEncoder.default\u001b[1;34m(self, o)\u001b[0m\n\u001b[0;32m 160\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mdefault\u001b[39m(\u001b[39mself\u001b[39m, o):\n\u001b[0;32m 161\u001b[0m \u001b[39m"""Implement this method in a subclass such that it returns\u001b[39;00m\n\u001b[0;32m 162\u001b[0m \u001b[39m a serializable object for
o
, or calls the base implementation\u001b[39;00m\n\u001b[0;32m 163\u001b[0m \u001b[39m (to raise aTypeError
).\u001b[39;00m\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 177\u001b[0m \n\u001b[0;32m 178\u001b[0m \u001b[39m """\u001b[39;00m\n\u001b[1;32m--> 179\u001b[0m \u001b[39mraise\u001b[39;00m \u001b[39mTypeError\u001b[39;00m(\u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39mObject of type \u001b[39m\u001b[39m{\u001b[39;00mo\u001b[39m.\u001b[39m\u001b[39m__class\u001b[39m\u001b[39m.\u001b[39m\u001b[39m__name\u001b[39m\u001b[39m}\u001b[39;00m\u001b[39m \u001b[39m\u001b[39m'\u001b[39m\n\u001b[0;32m 180\u001b[0m \u001b[39mf\u001b[39m\u001b[39m'\u001b[39m\u001b[39mis not JSON serializable\u001b[39m\u001b[39m'\u001b[39m)\n\n\u001b[1;31mTypeError\u001b[0m: Object of type Order is not JSON serializable"}
The text was updated successfully, but these errors were encountered: