Thursday, May 24, 2018

Python API Execution Server Setup


In this post, I'm outling the process i used to setup an execution server used to run API tests using python.

Setup an API automation ready execution server

  1. Confirm Python -version (python --version)
  2. Install pip (yum -y install python-pip)
  3. Install pip environment (https://docs.pipenv.org/) (pip install pipenv)
  4. Upgrade it (pip install --upgrade pip)
  5. Install requests module (pip2.7 install requests)
  6. Install git (Yum install gut -y)
  7. Clone the git repo (git clone git://github.com/requests/requests.git)
  8. Cd requests; pip install.

I also found the below guides very useful to get a fundamental understanding of api testing. 
  1. Beginner's Guide to API Automation with Python - https://www.grossum.com/blog/beginner-s-guide-to-automating-api-tests-using-python
  1. API Tutorials - https://www.dataquest.io/blog/python-api-tutorial/


GET Status codes
  • 200 -- everything went okay, and the result has been returned (if any)
  • 301 -- the server is redirecting you to a different endpoint. This can happen when a company switches domain names, or an endpoint name is changed.
  • 401 -- the server thinks you're not authenticated. This happens when you don't send the right credentials to access an API (we'll talk about authentication in a later post).
  • 400 -- the server thinks you made a bad request. This can happen when you don't send along the right data, among other things.
  • 403 -- the resource you're trying to access is forbidden -- you don't have the right permissions to see it.
  • 404 -- the resource you tried to access wasn't found on the server.

No comments:

Post a Comment