Can convert the Python API to be web application

1295
4
02-02-2017 09:03 AM
ZhanpingShi1
New Contributor

In addition to this kind of interactive working on the GIS data, can we deploy the ArcGIS Python API script like an independent Web Application can be running online?

Thanks,

Zhanping

0 Kudos
4 Replies
AtmaMani
Esri Contributor

This is an interesting thought. We have quite a few projects along these lines. Are you proposing something along the lines of https://try.jupyter.org/

0 Kudos
RohitSingh2
Esri Contributor

You could use the Python API in a Python Web framework like Django to create a web application.

RichardHughes2
Occasional Contributor III

Hi Rohit,

That is what I've been working on for the past year or so.  I am building a Django application with a RestAPI to integrate with backend SQL databases from other systems.  I am running into an issue where I need to create Level 1 Viewer Users for an organization so that they can print from AGOL.  When debugging in PyCharm, it worked once then I keep getting a Runtime Error: You do not have permissions to access this resource or perform this operation.

I'm gonna take break, then try to dig into it a little more.  Do you think that I need to create a thread or call an external script for the Python API or something to that effect so that the django system does not interfere? 

During one of my debugs I was able to create a test user.  Then I deleted it through the AGOL web page.  Since then I have been unable to create one.

Do you know if there are limits set on the AGOL server that would restrict how often users can be added or removed?

Also, when I try to create a user, it fails saving Unable to Create 'test_user'.  However when I search for the user I get a return but am unable to delete() it or query the privileges.  I get a permissions error and an exception is thrown.  That user is not visible in AGOL on the Organization page so I am thinking that the AGOL server might be throwing a fit or something.  

They have 30 Level 1 Users and 0 Free Level 2 Users, so this is to provide printing in a web app.  It would be great if I could manage these Viewers through the Python API when the print widget is activated.  If the user does not exist, create it.  I would then look at deleting the 5 users who have been inactive for a month if it gets full.

Thanks,

Rich

0 Kudos
RichardHughes2
Occasional Contributor III

Hi Rohit,

After taking that break, I was able to have the python api create the test user and remove the test user.  It really was as simple as configuring the user roles as "org_viewer", and the role as int(1).  In the documentation it states

"By default, your org has 3 roles - org_user, org_publisher and org_admin"

The role I am using is "org_viewer".  Should that also be considered a default role?

0 Kudos