Error 403 - When calling vhost api from python script on a Linux server

Collapse

Unconfigured Ad Widget

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Delaney martin
    Senior Member
    • Jun 2022
    • 191

    Error 403 - When calling vhost api from python script on a Linux server

    Hi,

    When calling the prod vhost API from the python script running on the server itself, we always get a 403 error with a default HTML error page.


    I appreciate your help.
  • Rex Maughan
    Senior Member
    • Mar 2022
    • 221

    #2
    Hi, you can try this:

    Make sure your script includes the correct credentials.

    Example:

    import requests


    url = "https://your-vhost-api.com/endpoint"

    headers = {

    "Authorization": "Bearer YOUR_API_TOKEN",

    "Content-Type": "application/json"

    }

    response = requests.get(url, headers=headers)

    print(response.status_code, response.text)

    Ensure your token is valid and hasn’t expired.


    Comment

    VPS Hosting
    Working...
    X