Python Forum
Python requests module doesn not return status_code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python requests module doesn not return status_code
#3
(May-21-2019, 07:15 AM)buran Wrote: remove the try/except and post the full traceback you get

Code after corrections:
def Read_POD(url, auth, data, dataframe=False):

    url = url + "api/v1/Catalog/NestScrollApi"
    req = requests.post(url, auth = auth, verify=False, json=data)
    if req.status_code == 404:
        return {"response": req.status_code}
    else:
        fin = req.json()
        xp = pd.DataFrame(fin)   
        return {"data": xp, "response": req.status_code}
Error:
Read_POD(tss_url, auth = auth, data = data) Traceback (most recent call last): File "<ipython-input-559-846437feeaef>", line 1, in <module> Read_POD(tss_url, auth = auth, data = data) File "<ipython-input-546-fa20f27d73e1>", line 9, in Read_POD xp = pd.DataFrame(fin) File "C:\Users\user123\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\frame.py", line 392, in __init__ mgr = init_dict(data, index, columns, dtype=dtype) File "C:\Users\user123\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\internals\construction.py", line 212, in init_dict return arrays_to_mgr(arrays, data_names, index, columns, dtype=dtype) File "C:\Users\user123\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\internals\construction.py", line 51, in arrays_to_mgr index = extract_index(arrays) File "C:\Users\user123\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pandas\core\internals\construction.py", line 308, in extract_index raise ValueError('If using all scalar values, you must pass' ValueError: If using all scalar values, you must pass an index
Reply


Messages In This Thread
RE: Python requests module doesn not return status_code - by palo173 - May-21-2019, 07:38 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python doesn't run! leon_heller 2 1,370 Nov-27-2024, 10:00 AM
Last Post: buran
  ModuleNotFoundError: No module named 'requests' Serg 18 10,861 Oct-29-2023, 11:33 PM
Last Post: Serg
  python requests library .JSON() error mHosseinDS86 6 7,750 Dec-19-2022, 08:28 PM
Last Post: deanhystad
  Python requests oauth2 access token herobpv 6 7,416 Sep-27-2021, 06:54 PM
Last Post: herobpv
  Help with requests module 0xB9 3 3,777 Mar-14-2021, 06:49 AM
Last Post: buran
  keyboard module doesn't work in the microsoft version terminal of python. username 1 4,085 Feb-25-2021, 05:19 PM
Last Post: Larz60+
  Python Requests SSL Aussie 0 2,470 Jan-07-2021, 02:09 AM
Last Post: Aussie
  'urllib3' Module not found when import 'requests' spanz 5 14,944 Jan-06-2021, 05:57 PM
Last Post: snippsat
  why doesn't python look in two directions Kakha 21 10,202 Jan-01-2021, 11:24 PM
Last Post: jefsummers
  Python Requests Aussie 2 3,538 Dec-23-2020, 03:24 AM
Last Post: Aussie

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020