Cannot deploy a simple Python thing

Description of the problem (please keep it simple and short):
I have two python scripts that have been deployed for at least a year. Now they are no longer available as they used to be so I am tying to deploy them.

Explain what you were trying to do:
I’m just trying to deploy them publically like they used to be, but clicking through the “deployment” screens.

I’ve tried creating a new Repl in case something was broken with the old, but this one fails in a different way. The screenshot below is the new one.

What areas or features are involved?
It’s a very simple console Python script.

Repl Cover Page Link/Screenshots/Etc: (to protect you and your code, never share your Repl join link outside of PMs)

:wave: Welcome @chazlarson!

We need more information to help you.

  1. What kind of Repl are you trying to deploy? (e.g. Discord bot, dynamic website [webserver])
  2. What type of deployment are you using? (e.g. Reserved VM [background worker/website], autoscale)
  3. Can you send a screenshot of the logs tab?
2 Likes

It’s a console app that asks the user for a couple values, then produces some text for that user to paste into a config file. It has no GUI, and used to run in what looked like a terminal in the old Replit.

I’m using autoscale.

The log tab is empty.

here’s the code; this is in main.py:

import requests

redirect_uri = "urn:ietf:wg:oauth:2.0:oob"
redirect_uri_encoded = redirect_uri.replace(":", "%3A")
base_url = "https://api.trakt.tv"

print("Let's authenticate against Trakt!\n\n")

client_id = input("Trakt Client ID: ").strip()
client_secret = input("Trakt Client Secret: ").strip()

url = f"https://trakt.tv/oauth/authorize?response_type=code&client_id={client_id}&redirect_uri={redirect_uri_encoded}"
print(f"Go to: {url}\n\n")
print("Follow the prompts.\n\n")

pin = input("Enter the Trakt pin from that web page: ").strip()
json = {
    "code": pin,
    "client_id": client_id,
    "client_secret": client_secret,
    "redirect_uri": redirect_uri,
    "grant_type": "authorization_code",
}
response = requests.post(f"{base_url}/oauth/token",
                         json=json,
                         headers={"Content-Type": "application/json"})

if response.status_code != 200:
  print("Trakt Error: Invalid trakt pin.")
else:
  print("Authentication successful; validating credentials...")

  headers = {
      "Content-Type": "application/json",
      "Authorization": f"Bearer {response.json()['access_token']}",
      "trakt-api-version": "2",
      "trakt-api-key": client_id,
  }

  validation_response = requests.get(f"{base_url}/users/settings",
                                     headers=headers)
  if validation_response.status_code == 423:
    print("Trakt Error: Account is locked; please contact Trakt Support")
  else:
    print("\n\nCopy the following into your PMM config.yml.")
# some print statements removed.

I used to point people to this, and tell them to click the run button; now there is no longer a run button.
Perhaps Replit doesn’t support that anymore.

Oh, and it runs fine in the console.

image

Autoscale is for webservers.

Deployments aren’t for your use case.

Deployments run forever. They don’t use input.

1 Like

Adding onto @QwertyQwerty88, your Repl shouldn’t be deployed at all @chazlarson. If people want to run it, they’ll need to fork it from your account.

2 Likes

Ah, I see, I guess that’s a change from the past. Thanks!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.