DEV Community

An Vo
An Vo

Posted on

HTTP Requests

HTTP Requests have some common request types:

  • /GET: request.get(): is used to retrieve data from a server.
GET https://api.user.org/users/?id=AAA
Enter fullscreen mode Exit fullscreen mode
  • /POST: request.post(): is used when sending data to the server to create new resources.
POST /api/users
Content-Type: application/json
{
  "id": "AAA",
  "name": "John Doe",
  "email": "john@testmail.com"
}
Enter fullscreen mode Exit fullscreen mode
  • /PUT: request.put(): is used to update or replace a resource on the server.
PUT /api/users/AAA
Content-Type: application/json

{
  "name": "AAA Smith",
  "email": "aaa@testmail.com"
}
Enter fullscreen mode Exit fullscreen mode
  • /DELETE: request.delete(): is used to remove or delete a resource on the server.
DELETE /api/users/AAA
Enter fullscreen mode Exit fullscreen mode
  • Sample Python code: Remember to create a .env file with TOKE, USERNAME, and ENDPOINT.
import os
import dotenv
import requests

PIXELA_TOKEN = os.getenv("PIXELA_TOKEN")
PIXELA_USERNAME = os.getenv("PIXELA_USERNAME")
PIXELA_ENDPOINT = os.getenv("PIXELA_ENDPOINT")
headers = {
    "X-USER-TOKEN": PIXELA_TOKEN
}

user_param = {
    "token": PIXELA_TOKEN,
    "username": PIXELA_USERNAME,
    "agreeTermsOfService": "yes",
    "notMinor": "yes"
}
response = requests.post(url=PIXELA_ENDPOINT, json=user_param)
print(response.text)

### {"message":"Success. Let's visit  ...
Enter fullscreen mode Exit fullscreen mode

Playwright CLI Flags Tutorial

5 Playwright CLI Flags That Will Transform Your Testing Workflow

  • 0:56 --last-failed: Zero in on just the tests that failed in your previous run
  • 2:34 --only-changed: Test only the spec files you've modified in git
  • 4:27 --repeat-each: Run tests multiple times to catch flaky behavior before it reaches production
  • 5:15 --forbid-only: Prevent accidental test.only commits from breaking your CI pipeline
  • 5:51 --ui --headed --workers 1: Debug visually with browser windows and sequential test execution

Learn how these powerful command-line options can save you time, strengthen your test suite, and streamline your Playwright testing experience. Click on any timestamp above to jump directly to that section in the tutorial!

Watch Full Video 📹️

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay