Skip to content
This repository was archived by the owner on Mar 31, 2020. It is now read-only.

ArcRest was working then quit--no changes to script #345

@badavis57007

Description

@badavis57007

ArcRest

I wrote the following code. The code was running just fine. I installed ArcRest using PIP and it worked great. Then I was adding functionality, I ran it, Python hung up, then it crashed. If throws the following error below. See below for my fixes (I thought the file became corrupted). It was running fine and continues to fail. Nothing has changed in the code that I was using and it worked fine before. The security handler is not working anymore even though it is there. I have tried the security handler with arcrest.security.security.AGOLTokenSecurityHandler as well:

import arcrest
import os
import arcpy as env
import arcpy

arcpy.env.workspace = r"I:\GISStaff\Temp"

Step 3. Get Local Copy of AGOL Feature Services and put in File Geodatabase.

3A. Log into AGOL using AGOLTokenSecurity Handler and manageorg.administration to access content

uname = "Username"
pword = "Password"

site = "http://OrganizationAccount.maps.arcgis.com"

sh=arcrest.AGOLTokenSecurityHandler(uname, pword, site)
admin = arcrest.manageorg.administration.Administration(securityHandler=sh)
content = admin.content
user = content.users.user(uname)
print "accessed content"

Version or date of download

Downloaded June 7th. Using PIP. Version 3.5.9. When I reloaded this version with pip, it said it loaded successfully but there were failures listed in the command prompt before the successful note.

Bug

Repo Steps or Enhancement details

I thought it was corrupted. I uninstalled ArcMap, Python, everything. Did a full reinstall. It still throws the error listed below.
Traceback (most recent call last):
File "C:\Python27\ArcGIS10.3\Lib\site-packages\Pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
exec codeObject in main.dict
File "\county.allegheny.local\users\DCS\T109840\Desktop\ExportAGOLLayer.py", line 19, in
sh=arcrest.AGOLTokenSecurityHandler(uname, pword, site)
File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\security\security.py", line 1177, in init
self._initURL(org_url=org_url,token_url=token_url)
File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\security\security.py", line 1205, in _initURL
proxy_url=self._proxy_url)
File "C:\Python27\ArcGIS10.3\lib\site-packages\arcrest\web_base.py", line 598, in _get
ctx = ssl.create_default_context()
AttributeError: 'module' object has no attribute 'create_default_context'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions