Skip to content

External 'requests.post' not working #3284

@jeff1evesque

Description

@jeff1evesque

When issuing a requests.post from outside the corresponding docker unit tests, we get a 500 error. Specifically, the following was tested from a vagrant virtual machine:

import requests

username = 'xxxxxxxxxxxx'
password = 'xxxxxxxxxxxx'
endpoint = 'xxxxxxxxxxx'
port = 8585
headers = {
    'Content-Type': 'application/json',
}

login = requests.post(
    'https://{}:{}/login'.format(endpoint, port),
    headers=headers,
    data={'user[login]': username, 'user[password]': password},
    verify=False
)
token = login.json

print('token: {}'.format(repr(token)))

Then, we get the following error:

root@ip-172-31-47-47:/home/ubuntu/ist-652# python3 test.py
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:794: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
token: <bound method Response.json of <Response [500]>>

Note: we used the verify = False, since the corresponding application implements a self signed certificate. Additionally, the application redirects all http requests to https.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions