Skip to main content
Answer

API Login Maximum Retries

  • June 19, 2024
  • 8 replies
  • 107 views

Forum|alt.badge.img+3

hi, I am trying to get login using python code. My code is working fine in localhost. But when I am trying to do it with my company testing env . The login is raising Max retries error. I think This is because of logout. I tried same api in post man and it works fine over there. 

 

 

 

HTTPConnectionPool(host='acusb.mycompany.local', port=80): Max retries exceeded with url: /entity/Auth/login (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x000001FB3A068BD0>: Failed to resolve 'acusb.mycompany.local' ([Errno 11001] getaddrinfo failed)"))

Best answer by tahayabali

I got the solution. Thanks for helping. It was DNS issue. I replaced DNS and add socket method.   it works fine now

8 replies

Forum|alt.badge.img+3
  • Author
  • Captain I
  • June 20, 2024

@darylbowman your comment is very help full for me. 


darylbowman
Captain II
Forum|alt.badge.img+15

I'm not a python dev, but it seems like it's having trouble resolving the hostname.

Here's an SO thread about it.

 

If you post your code, someone else may be able to contribute.


Forum|alt.badge.img+3
  • Author
  • Captain I
  • June 20, 2024

Yes it’s unable to find the domain name. I got access to testing env and in the browser it works fine but through python code same error. I also tried to ping but no response from acusb.mycomany.local.  Below is my python code

 

def login_to_acumatica_for_tax():

    url = "http://acusb.acusb.mycompany.local/entity/Auth/login"

 

    payload = json.dumps({

    "name": "myuser",

    "password": "xxx}",

    "tenat": "test",

    "branch": "",

    "locale": ""

    })

    session = requests.Session()

    headers = {

    'Content-Type': 'application/json'}

    response = session.post(url, headers=headers, data=json.dumps(payload))

 

    print(response.text)

 


darylbowman
Captain II
Forum|alt.badge.img+15

    url = "http://acusb.acusb.mycompany.local/entity/Auth/login"

Is this a mistype?


Forum|alt.badge.img+3
  • Author
  • Captain I
  • June 20, 2024

Yeah this is mistype here only not in code


darylbowman
Captain II
Forum|alt.badge.img+15

It seems like you may have a network issue or something similar. I don’t think I can help much with it.


Forum|alt.badge.img+3
  • Author
  • Captain I
  • June 20, 2024

Thanks appreciated 


Forum|alt.badge.img+3
  • Author
  • Captain I
  • Answer
  • June 21, 2024

I got the solution. Thanks for helping. It was DNS issue. I replaced DNS and add socket method.   it works fine now