Select to view content in your preferred language

Generate Token - Python Code ArcGIS Enterprise HA

845
2
10-06-2021 11:01 AM
WellingtonChristian_Rodrigues_
Esri Contributor

Hi All,

 

I'm getting some strange behavior in my HA ArcGIS Enterprise on AWS. It taken to long (21 seconds) to generate a token through a python code, it's the code:

 

import time

import requests

import json

 

def generate_token():

   start_time = time.time()

   payload = { 'username': 'usuario', 'password': 'SECRET', 'referer': 'https://SITE.com.br/portal/portaladmin', 'f': 'json' }

   r = requests.post('https://SITE.com.br/portal/sharing/rest/generateToken', data=payload)

   response = json.loads(r.text)

   token = response['token']

   print("--- %s segundos ---" % (time.time() - start_time))

   return token

 

print(generate_token())

 

When I run this code at my staging environment without ELB the code works very well and token is generated quickly.

 

Does someone had faced this issue?

Or any tip

 My environment is 10.8.1

 Thanks and Regards,

Wellington

2 Replies
ChristopherPawlyszyn
Esri Contributor

Can you test locally with port 7443 for each Portal machine and the web adaptor (if present)? That would tell us whether the delay is indeed introduced by the ELB or if there is something else going on in the deployment.

Additionally it may be useful to enable access logging on the ELB for some insight into the web requests in transit.


-- Chris Pawlyszyn
0 Kudos
WellingtonChristian_Rodrigues_
Esri Contributor

Hi @ChristopherPawlyszyn 

I did it last friday hitting on 7443 and through the web adaptor, this way I could generate token quickly. Additionally I've even changed the ELB from Classic to Application ELB, nothing different till now. 😞

0 Kudos