<?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: Token: OSError: Int or String expected in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061898#M6126</link>
    <description>&lt;P&gt;I think that the issue is that you're sending a POST with query parameters in the URL string instead of inside the post body.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 26 May 2021 17:01:10 GMT</pubDate>
    <dc:creator>RandallWilliams</dc:creator>
    <dc:date>2021-05-26T17:01:10Z</dc:date>
    <item>
      <title>Token: OSError: Int or String expected</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061715#M6123</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;I am unable to get the Token in my current environment, due to certificates??&lt;/P&gt;&lt;P&gt;I am trying to get a request working to retrieve the token but keep getting an &amp;lt;&lt;STRONG&gt;OSError: Int or String expected&lt;/STRONG&gt;&amp;gt; error??&lt;/P&gt;&lt;P&gt;The code is:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;params = {'username': username, 'password': password, 'referer': bccreferer, 'f': 'pjson'}
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "*.*"}
port = 6443

#### For Python 3
#### req = urllib.request("POST"(tokenURL, urlencode(params)))
#### response = urlopen(req)
conn = http.client.HTTPSConnection(tokenURL, params)
conn.request("POST", "", params, headers)
response = conn.getresponse()
print(response.status, response.reason)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error points to:&amp;nbsp;&lt;/P&gt;&lt;P&gt;conn.request("POST", "", params, headers)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate any pointers to resolve this issue.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Clive&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 11:27:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061715#M6123</guid>
      <dc:creator>CliveSwan</dc:creator>
      <dc:date>2021-05-26T11:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Token: OSError: Int or String expected</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061724#M6124</link>
      <description>&lt;P&gt;I am trying to get similar code to work with https protocol as I was able to get it to work with http protocol, but that would not meet production security requirements.&lt;/P&gt;&lt;P&gt;Did you pull this code from an ESRI sample?&amp;nbsp; I ask because I have a line of code that is similar, but there is a difference so I'm wondering if that could be part of your problem.&lt;/P&gt;&lt;P&gt;params = urllib.urlencode({'username': username, 'password': password, 'client': 'requestip', 'f': 'json'})&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 12:01:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061724#M6124</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-05-26T12:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: Token: OSError: Int or String expected</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061898#M6126</link>
      <description>&lt;P&gt;I think that the issue is that you're sending a POST with query parameters in the URL string instead of inside the post body.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 17:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061898#M6126</guid>
      <dc:creator>RandallWilliams</dc:creator>
      <dc:date>2021-05-26T17:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: Token: OSError: Int or String expected</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061904#M6127</link>
      <description>&lt;P&gt;Can you please make a suggestion on how it should be formatted in order to work?&amp;nbsp; I am having similar issues with this type of script and currently I am sort of at a loss for what the root cause of the issue is.&lt;/P&gt;&lt;P&gt;&lt;A href="http://&amp;quot;fully" target="_blank"&gt;I can make this http call manually in a browser&amp;nbsp; &lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://&amp;quot;fully" target="_blank"&gt;http://"fully&lt;/A&gt;&amp;nbsp;qualified server domain name":6080/arcgis/admin/generateToken&lt;/P&gt;&lt;P&gt;I can also make this https call manually in a brower&lt;/P&gt;&lt;P&gt;&lt;A href="https://&amp;quot;web" target="_blank"&gt;https://"web&lt;/A&gt;&amp;nbsp;adaptor name"/server/admin/generateToken&lt;/P&gt;&lt;P&gt;But when I run in python code the token does not appear to get generated successfully.&lt;/P&gt;</description>
      <pubDate>Wed, 26 May 2021 17:54:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/token-oserror-int-or-string-expected/m-p/1061904#M6127</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2021-05-26T17:54:37Z</dc:date>
    </item>
  </channel>
</rss>

