Editing Hub page text using python

1080
17
05-09-2022 12:41 PM
Steve_Graham
New Contributor II

How can I edit text on an ArcGIS Hub site page? 

0 Kudos
17 Replies
ManushiMajumdar
Esri Contributor

Let me give you an example for your case:

 

```

layout  = mySite.layout

#Assign same value with change to layout

layout.sections[0].ROWS[0].cards[0].component.settings.markdown = "<h1 id='our-community'>New Text</h1><p>The information included below provides context for the Hazard Mitigation Plan. Environmental, social, and economic characteristics of a county make it unique.&nbsp;</p><p><br></p>"

mySite.update_layout(layout)

```

 

Refer to the notebook and the Github repo I shared earlier for examples on how to edit sites and pages.

 

0 Kudos
Steve_Graham
New Contributor II

Does this work for you? it does not work for me

page1 = myhub.pages.get('###############################')
layout  = page1.layout
layout.sections[0].ROWS[0].cards[0].component.settings.markdown = "<h1 id='our-community'>New Text</h1><p>The information included below provides context for the Hazard Mitigation Plan. Environmental, social, and economic characteristics of a county make it unique.&nbsp;</p><p><br></p>"
page1.update_layout(layout)
 
0 Kudos
ManushiMajumdar
Esri Contributor

Do you have the permissions to edit this page? Can you manually edit and publish changes to this site?

0 Kudos
Steve_Graham
New Contributor II

Yes as I stated above - I can edit using a browser  at hub.arcgis.com

0 Kudos
Steve_Graham
New Contributor II

do you have success using any code to edit text?

0 Kudos
ManushiMajumdar
Esri Contributor

yes, this has worked several times in the past.

0 Kudos
ManushiMajumdar
Esri Contributor

In that case can you email me a screenshot of the exact code + error trace in the notebook?

Also I'd like to know:

1. Are you running this in your local environment or ArcGIS notebooks?

2. Are you using the `arcgis` package or `arcgishub` package?

3. Do you have the most updated versions of both those packages?

0 Kudos
Steve_Graham
New Contributor II

I sent you a message as soon as you sent this - a few weeks ago, and I was wondering if you received my message?

0 Kudos