|
28 | 28 | },
|
29 | 29 | {
|
30 | 30 | "cell_type": "code",
|
31 |
| - "execution_count": null, |
| 31 | + "execution_count": 2, |
32 | 32 | "metadata": {},
|
33 | 33 | "outputs": [],
|
34 | 34 | "source": [
|
|
51 | 51 | "cell_type": "markdown",
|
52 | 52 | "metadata": {},
|
53 | 53 | "source": [
|
54 |
| - "As mentioned in the [`gis module`](https://developers.arcgis.com/python/guide/the-gis-module/) guide, the Python API uses [Resource Manager classes](https://developers.arcgis.com/python/guide/the-gis-module/) to manage Web GIS users, groups, datastores, and content. You access the [`UserManager`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager), [`GroupManager`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#groupmanager) and [`ContentManager`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager) classes as the `users`, `groups`, and `content` properties of the [`GIS`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#gis), respectively. (See [`Helper objects`](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#gis) for details.)\n", |
| 54 | + "As mentioned in the [`gis module`](/python/guide/the-gis-module/) guide, the Python API uses [Resource Manager classes](/python/guide/the-gis-module/) to manage Web GIS users, groups, datastores, and content. You access the [`UserManager`](/python/api-reference/arcgis.gis.toc.html#arcgis.gis.UserManager), [`GroupManager`](/python/api-reference/arcgis.gis.toc.html#groupmanager) and [`ContentManager`](/python/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager) classes as the `users`, `groups`, and `content` properties of the [`GIS`](/python/api-reference/arcgis.gis.toc.html#gis), respectively.\n", |
55 | 55 | "\n",
|
56 |
| - "Each resource manager implements the [ArcGIS REST API](https://developers.arcgis.com/rest/users-groups-and-items/search.htm) `search` operation as a method. For example, `gis.content.search()`. It's important to understand that the `search` mechanism uses many different inputs to find possible matches, ranks them and returns appropriate results. The `search` becomes ideal for human interaction, but `fuzzy` when looking for specific records programmatically. The search results are non-deterministic. Using `search` may not necessarily be the best approach for finding specific items, but more a group of items from which to further filter. \n", |
| 56 | + "Each searchj resource manager, for example _gis.content.search(), implements the [ArcGIS REST API](/rest/users-groups-and-items/search.htm) `search` operation. It's important to understand that the `search` mechanism uses many different inputs to find possible matches, ranks them and returns appropriate results. The `search` becomes ideal for human interaction, but `fuzzy` when looking for specific records programmatically. The search results are non-deterministic. Using `search` may not necessarily be the best approach for finding specific items, but more a group of items from which to further filter. \n", |
57 | 57 | "\n",
|
58 | 58 | "It's also important to know that using `search` programmatically, like with the Python API, does not correspond identically to searching with an application written in a different language. The various `search` options in the ArcGIS Online or Portal for ArcGIS Enterprise interfaces work differently than the Python API resource managers' `search`. Different applications may use different inputs. The relationship between a content `search` in one application, like a Portal or ArcGIS Online viewer, is not one-to-one with a content search using the Python API even when logged in as the same user.\n",
|
59 | 59 | "\n",
|
|
62 | 62 | },
|
63 | 63 | {
|
64 | 64 | "cell_type": "code",
|
65 |
| - "execution_count": 2, |
| 65 | + "execution_count": 3, |
66 | 66 | "metadata": {},
|
67 | 67 | "outputs": [],
|
68 | 68 | "source": [
|
|
190 | 190 | },
|
191 | 191 | {
|
192 | 192 | "cell_type": "code",
|
193 |
| - "execution_count": 4, |
| 193 | + "execution_count": 37, |
194 | 194 | "metadata": {},
|
195 | 195 | "outputs": [],
|
196 | 196 | "source": [
|
197 |
| - "day_start = dt.datetime(2019, 5, 30, 0, 0, 0, 0)\n", |
198 |
| - "day_end = dt.datetime(2019, 5, 30, 23, 59, 59, 999999)\n", |
| 197 | + "day_start = dt.datetime(2023, 9, 21, 0, 0, 0, 0)\n", |
| 198 | + "day_end = dt.datetime(2023, 9, 21, 23, 59, 59, 999999)\n", |
199 | 199 | "\n",
|
200 | 200 | "start_timestamp = int(day_start.timestamp() * 1000)\n",
|
201 | 201 | "end_timestamp = int(day_end.timestamp() * 1000)"
|
|
210 | 210 | },
|
211 | 211 | {
|
212 | 212 | "cell_type": "code",
|
213 |
| - "execution_count": 5, |
| 213 | + "execution_count": 40, |
214 | 214 | "metadata": {},
|
215 | 215 | "outputs": [],
|
216 | 216 | "source": [
|
217 |
| - "content_published_53019 = [item\n", |
218 |
| - " for item in gis.content.search(query=\"* AND \\\n", |
219 |
| - " owner:\" + gis.users.me.username,\n", |
220 |
| - " max_items=50)\n", |
221 |
| - " if item.created > start_timestamp \n", |
222 |
| - " and item.created < end_timestamp]" |
| 217 | + "content_published_92123 = [\n", |
| 218 | + " item\n", |
| 219 | + " for item in gis.content.search(\n", |
| 220 | + " query=f\"owner:{gis.users.me.username}\",\n", |
| 221 | + " max_items=100) \n", |
| 222 | + " if item.created > start_timestamp\n", |
| 223 | + " and item.created < end_timestamp]" |
223 | 224 | ]
|
224 | 225 | },
|
225 | 226 | {
|
|
231 | 232 | },
|
232 | 233 | {
|
233 | 234 | "cell_type": "code",
|
234 |
| - "execution_count": 6, |
| 235 | + "execution_count": 41, |
235 | 236 | "metadata": {},
|
236 | 237 | "outputs": [],
|
237 | 238 | "source": [
|
|
241 | 242 | },
|
242 | 243 | {
|
243 | 244 | "cell_type": "code",
|
244 |
| - "execution_count": 7, |
| 245 | + "execution_count": 45, |
245 | 246 | "metadata": {},
|
246 | 247 | "outputs": [
|
247 | 248 | {
|
248 | 249 | "name": "stdout",
|
249 | 250 | "output_type": "stream",
|
250 | 251 | "text": [
|
251 |
| - "Item Title Item Type Published \n" |
| 252 | + "Item Title Item Type Published \n", |
| 253 | + "425e9ee3dd774bbe8d472b73e9cadbd2 File Geodatabase September 21 2023 at 10:45.47 AM \n", |
| 254 | + "ad37530ecc3744e8b3a9db52adde6408 File Geodatabase September 21 2023 at 10:43.44 AM \n" |
252 | 255 | ]
|
253 | 256 | }
|
254 | 257 | ],
|
|
258 | 261 | "publish = \"Published\"\n",
|
259 | 262 | "print(f\"{title:40}{item_type:25}{publish:40}\")\n",
|
260 | 263 | "\n",
|
261 |
| - "for content in content_published_53019:\n", |
262 |
| - " print(f\" {content.title:<40} {content.type:25} {readable_date(content.created):40}\")" |
| 264 | + "for content in content_published_92123:\n", |
| 265 | + " print(f\"{content.title:<40}{content.type:25}{readable_date(content.created):40}\")" |
263 | 266 | ]
|
264 | 267 | },
|
265 | 268 | {
|
|
1480 | 1483 | "thumbnail_path = os.path.join(data_path, \"earthquake.png\")\n",
|
1481 | 1484 | "\n",
|
1482 | 1485 | "root_folder = gis.content.folders.get()\n",
|
1483 |
| - "earthquake_csv_item = root_folder.add(item_properties=csv_properties, data=csv_path,\n", |
1484 |
| - " thumbnail = thumbnail_path).result()" |
| 1486 | + "earthquake_csv_item = root_folder.add(\n", |
| 1487 | + " item_properties=csv_properties, \n", |
| 1488 | + " data=csv_path,\n", |
| 1489 | + " thumbnail = thumbnail_path\n", |
| 1490 | + ").result()" |
1485 | 1491 | ]
|
1486 | 1492 | },
|
1487 | 1493 | {
|
|
1605 | 1611 | {
|
1606 | 1612 | "cell_type": "markdown",
|
1607 | 1613 | "metadata": {
|
1608 |
| - "collapsed": true |
| 1614 | + "collapsed": true, |
| 1615 | + "jupyter": { |
| 1616 | + "outputs_hidden": true |
| 1617 | + } |
1609 | 1618 | },
|
1610 | 1619 | "source": [
|
1611 | 1620 | "<a id=\"importing-data-from-a-pandas-data-frame\"></a>\n",
|
|
2454 | 2463 | "execution_count": 38,
|
2455 | 2464 | "metadata": {},
|
2456 | 2465 | "outputs": [
|
2457 |
| - { |
2458 |
| - "name": "stderr", |
2459 |
| - "output_type": "stream", |
2460 |
| - "text": [ |
2461 |
| - "C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3553: DeprecatedWarning: create_folder is deprecated as of 2.3.0 and has be removed in 3.0.0. Use `gis.content.folders.create` instead.\n", |
2462 |
| - " exec(code_obj, self.user_global_ns, self.user_ns)\n" |
2463 |
| - ] |
2464 |
| - }, |
2465 | 2466 | {
|
2466 | 2467 | "data": {
|
2467 | 2468 | "text/plain": [
|
|
2540 | 2541 | "execution_count": 41,
|
2541 | 2542 | "metadata": {},
|
2542 | 2543 | "outputs": [
|
2543 |
| - { |
2544 |
| - "name": "stderr", |
2545 |
| - "output_type": "stream", |
2546 |
| - "text": [ |
2547 |
| - "C:\\Users\\tar12555\\AppData\\Local\\ESRI\\conda\\envs\\pyapi-dev\\lib\\site-packages\\IPython\\core\\interactiveshell.py:3553: DeprecatedWarning: delete_folder is deprecated as of 2.3.0 and has be removed in 3.0.0. Use `Folder.delete()` instead.\n", |
2548 |
| - " exec(code_obj, self.user_global_ns, self.user_ns)\n" |
2549 |
| - ] |
2550 |
| - }, |
2551 | 2544 | {
|
2552 | 2545 | "data": {
|
2553 | 2546 | "text/plain": [
|
|
2589 | 2582 | "name": "python",
|
2590 | 2583 | "nbconvert_exporter": "python",
|
2591 | 2584 | "pygments_lexer": "ipython3",
|
2592 |
| - "version": "3.9.16" |
| 2585 | + "version": "3.11.0" |
2593 | 2586 | },
|
2594 | 2587 | "toc": {
|
2595 | 2588 | "base_numbering": 1,
|
|
2635 | 2628 | }
|
2636 | 2629 | },
|
2637 | 2630 | "nbformat": 4,
|
2638 |
| - "nbformat_minor": 1 |
| 2631 | + "nbformat_minor": 4 |
2639 | 2632 | }
|
0 commit comments