I was trying to upload a CSV file on ArcGIS with Python. I wrote the code :
import pandas as pd
from arcgis import GIS
import os
import datetime
import shutil
URL = "https://www.arcgis.com/"
gis = GIS(url=URL, username="nimish", password="############")
csv1 = '/home/nimish/PycharmProjects/freelancer/project6/csv_files/capitals_1.csv'
cities_df_1 = pd.read_csv(csv1)
print(cities_df_1.head())
print(cities_df_1.shape)
data_pth = "/home/nimish/PycharmProjects/freelancer/project6/csv_files/backup/"
now_ts = str(int(datetime.datetime.now().timestamp())) # current timestamp
# copy the file, appending the unique string and assign it to a variable
my_csv = shutil.copyfile(os.path.abspath(csv1),
os.path.join(data_pth, 'capitals_1_' + now_ts + '.csv'))
item_prop = {'title': 'Sample spreadsheet ' + now_ts}
csv_item = gis.content.add(item_properties=item_prop, data=my_csv)
print(csv_item)
cities_item = csv_item.publish()
print(cities_item)
item_prop = {'title': 'USA Capitals'}
cities_item.update(item_properties=item_prop, thumbnail='data/updating_gis_content/capital_cities.png')
# Uploaded first CSV uptil here
But it displays an error RuntimeError: Unable to publish item. User 'nimishbansal' does not have publishing privileges. (Error Code: 400)
What can I do?