I'm the same person who posted about this in the ArcGIS API for Python forum. I'm trying use the publish() method in a stand-alone script. The only documentation I see for it is for the API. I'm able to publish a CSV in a Pro Notebook. But, when I try this in a python IDE the script runs but produces nothing but an error:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
The error is coming from this line:
}, data=fp)
Script:
from arcgis.gis import GIS
import os
gis_dest = GIS('portalurl', 'user', 'pass')
# data
fp = r'C:\Users\jpilbeam\Test\c19_Vaccine.csv'
# content manager
cm = gis_dest.content
# 1. add
item = cm.add(item_properties={
'type' : 'CSV',
'title' : 'c19',
'tags' : 'tags',
'typeKeywords' : "CSV"
}, data=fp)
# 2. analyze
analyze_csv = cm.analyze(item=item, file_type='csv')
pp = analyze_csv['publishParameters']
# 3. Modify the publish parameters then publish
# For tables ensure the `locationType` is None
pp['locationType'] = 'none'
pitem = item.publish(publish_parameters=pp, file_type='csv')