<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Accessing REST API using AWS Lambda in ArcGIS REST APIs and Services Questions</title>
    <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/accessing-rest-api-using-aws-lambda/m-p/1013528#M3671</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Think you've missed the capital letter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;response = request.post(url, data=parameters, headers=headers)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;response = Request.post(url, data=parameters, headers=headers)&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 04 Jan 2021 10:53:50 GMT</pubDate>
    <dc:creator>DavidPike</dc:creator>
    <dc:date>2021-01-04T10:53:50Z</dc:date>
    <item>
      <title>Accessing REST API using AWS Lambda</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/accessing-rest-api-using-aws-lambda/m-p/1013484#M3670</link>
      <description>&lt;P&gt;I am trying to write a python script via they AWS Lambda interface to generate a token and then use that token to get various attributes of the ArcGIS portal.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The question I have is how to set up Lambda to access the various libraries correctly?&lt;/P&gt;&lt;P&gt;The simple script I have is getting the following so I suspect I just don't have all the libraries installed but I don't know where that needs to happen in an AWS Lambda environment.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;&lt;STRONG&gt;[ERROR] NameError: name 'request' is not defined&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;My script is a follows:&lt;/P&gt;&lt;P&gt;from urllib.parse import urlencode&lt;BR /&gt;from urllib.request import Request, urlopen&lt;BR /&gt;import json&lt;/P&gt;&lt;P&gt;#define variables&lt;BR /&gt;portalUrl = "&lt;A href="https://admin.portal.arcgis" target="_blank"&gt;https://admin.portal.arcgis&lt;/A&gt;"&lt;BR /&gt;username = 'yyyyyyy'&lt;BR /&gt;password = "xxxxxxx"&lt;/P&gt;&lt;P&gt;# Get a security token to append to all requests&lt;BR /&gt;def generateToken(username, password, portalUrl):&lt;BR /&gt;&lt;BR /&gt;# Retrieves a token to be used with API requests.&lt;BR /&gt;headers = {'content-type': 'application/x-www-form-urlencoded'}&lt;BR /&gt;parameters = {'username': username,&lt;BR /&gt;'password': password,&lt;BR /&gt;'client': 'referer',&lt;BR /&gt;'referer': portalUrl,&lt;BR /&gt;'expiration': 60,&lt;BR /&gt;'f': 'json'}&lt;BR /&gt;url = portalUrl + '/sharing/rest/generateToken?'&lt;BR /&gt;response = request.post(url, data=parameters, headers=headers)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 02:15:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/accessing-rest-api-using-aws-lambda/m-p/1013484#M3670</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2021-01-04T02:15:05Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing REST API using AWS Lambda</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/accessing-rest-api-using-aws-lambda/m-p/1013528#M3671</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Think you've missed the capital letter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;response = request.post(url, data=parameters, headers=headers)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;response = Request.post(url, data=parameters, headers=headers)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 10:53:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/accessing-rest-api-using-aws-lambda/m-p/1013528#M3671</guid>
      <dc:creator>DavidPike</dc:creator>
      <dc:date>2021-01-04T10:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: Accessing REST API using AWS Lambda</title>
      <link>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/accessing-rest-api-using-aws-lambda/m-p/1013805#M3672</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/167692"&gt;@DavidPike&lt;/a&gt;&amp;nbsp;, sometimes you can't see the forest for the trees &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jan 2021 23:16:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-rest-apis-and-services-questions/accessing-rest-api-using-aws-lambda/m-p/1013805#M3672</guid>
      <dc:creator>DeanHowell1</dc:creator>
      <dc:date>2021-01-04T23:16:00Z</dc:date>
    </item>
  </channel>
</rss>

