POST
|
Get further. Able to see that feature 1034 was added. Get error when trying to send email via gmail: Generating Token [1034] Traceback (most recent call last): File "H:/Custom_WebApp_Code/Send_Email.py", line 64, in <module> smtpObj = smtplib.SMTP(host=smtpServer, port=portNumber) File "C:\Python27\ArcGIS10.6\lib\smtplib.py", line 256, in __init__ (code, msg) = self.connect(host, port) File "C:\Python27\ArcGIS10.6\lib\smtplib.py", line 318, in connect (code, msg) = self.getreply() File "C:\Python27\ArcGIS10.6\lib\smtplib.py", line 369, in getreply raise SMTPServerDisconnected("Connection unexpectedly closed") SMTPServerDisconnected: Connection unexpectedly closed
... View more
07-17-2018
11:48 AM
|
0
|
11
|
858
|
POST
|
Thanks for the info. Where do I add the intro.js-master folder? How/where do I create the configuration file?
... View more
07-17-2018
09:19 AM
|
0
|
0
|
432
|
POST
|
Error picture attached to my previous reply. Updated code (with a few omissions): import urllib2, json, urllib, datetime, time, smtplib
from datetime import timedelta
# Variables
username = 'OMIT' # AGOL Username
password = 'OMIT' # AGOL Password
URL = 'https://services8.arcgis.com/XWI9YRo0bQGkCetU/arcgis/rest/services/service_OMIT6b3cc03bba146dc6d/FeatureServer/0?token=_S4wrFEfVufazfz-WrYOMITkfEYttuqysvDW4vGTYmSB-U2llBo-jmho_VuL_mJHxZ0tozqggUjYruB4yrwNURIYIQx6GEyzqFkje5x71sKeRbOMITQQXhuDX3gGKjkdk5sBzDFe_EMv4YSNdWE_GQVVmWtZgnhtv27_wnOJ98pppE24KNi5ls68nRgqyrrp3EsEd_JzKgQk_XusMUAiFjeyjI73cNLyJpKwtvhH3ExSnlPMav9cCf0-lV9iobuGn_Tw..' # Feature Service URL
uniqueID = 'OBJECTID' # i.e. OBJECTID
dateField = 'created_date' # Date field to query
hoursValue = 1 # Number of hours to check when a feature was added
fromEmail = 'OMIT' # Email sender
toEmail = 'OMIT' # Email receiver
smtpServer = 'OMIT' # SMPT Server Name
portNumber = 25 # SMTP Server port
# Create empty list for uniqueIDs
oidList = []
# Generate AGOL token
try:
print('Generating Token')
tokenURL = 'https://www.arcgis.com/sharing/rest/generateToken'
params = {'f': 'pjson', 'username': username, 'password': password, 'referer': 'http://www.arcgis.com'}
req = urllib2.Request(tokenURL, urllib.urlencode(params))
response = urllib2.urlopen(req)
data = json.load(response)
token = data['token']
except:
token = ''
# Query service and check if created_date time is within the last hour
params = {'f': 'pjson', 'where': "1=1", 'outfields' : '{0}, {1}'.format(uniqueID, dateField), 'returnGeometry' : 'false', 'token' : token}
req = urllib2.Request(URL, urllib.urlencode(params))
response = urllib2.urlopen(req)
data = json.load(response)
for feat in data['features']:
createDate = feat['attributes'][dateField]
createDate = int(str(createDate)[0:-3])
t = datetime.datetime.now() - timedelta(hours=hoursValue)
t = time.mktime(t.timetuple())
if createDate > t:
oidList.append(feat['attributes'][uniqueID])
print(oidList)
# Email Info
FROM = fromEmail
TO = [toEmail]
SUBJECT = 'New Features Added'
TEXT = "Features with {0}s {1} were added.".format(uniqueID, oidList)
message = """\
From: %s
To: %s
Subject: %s
%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
# If new features exist, send email
if len(oidList) > 0:
smtpObj = smtplib.SMTP(host=smtpServer, port=portNumber)
smtpObj.sendmail(FROM, TO, message)
print "Successfully sent email"
smtpObj.quit()
... View more
07-17-2018
09:02 AM
|
0
|
1
|
2764
|
POST
|
This code works except for one part...when other layers are added the popup box disappears but the purple dot sticks around when clicking on map.
... View more
07-17-2018
08:43 AM
|
0
|
0
|
644
|
POST
|
Hi Jake, Played around with it a bit but keep getting this error:
... View more
07-17-2018
08:24 AM
|
0
|
1
|
2764
|
POST
|
I'm looking to have an email sent out each time my hosted feature service (on AGOL) has my status field altered. This status field is set to "not complete" by default, and as its completed it changes to "complete". When this happens I want an email sent out. I've been playing around with webhooks and services likes Microsoft Flow and Integromat but not having too much success. Any ideas?
... View more
07-17-2018
06:55 AM
|
0
|
23
|
5891
|
POST
|
Figured it out! If the geopoint is set to required and I pass in coordinates via URL, the map displays in the web version
... View more
07-16-2018
12:40 PM
|
0
|
0
|
700
|
POST
|
Right now I've implemented the Layer Toggle button by Robert. Now I just want users to know what it does. How can I make the icon size larger and include descriptive user text next to it (outside of the widget button)?
... View more
07-16-2018
12:38 PM
|
0
|
3
|
659
|
POST
|
Figured it out! If you set the geopoint to required, the map displays on the web version
... View more
07-16-2018
12:25 PM
|
0
|
0
|
256
|
POST
|
I'm still hosting this locally in WAB...shouldn't make a difference though
... View more
07-16-2018
07:06 AM
|
0
|
1
|
561
|
POST
|
Can I at least change the "Set Location" button text to something like location confirmed?
... View more
07-16-2018
06:50 AM
|
0
|
0
|
3339
|
Title | Kudos | Posted |
---|---|---|
1 | 10-31-2018 08:24 AM | |
3 | 12-18-2018 09:23 AM | |
1 | 12-02-2019 07:53 AM | |
1 | 04-24-2020 11:11 AM | |
1 | 08-14-2019 02:25 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|