Skip to content

Commit

Permalink
Update best_practices_modify.py for bestpractices.dev (#2161)
Browse files Browse the repository at this point in the history
* Update best_practices_modify.py for bestpractices.dev

The API modifier code never got updated for the bestpractices.dev URL change.

* Update best_practices_modify.py - keep epilog formatted better

The epilog is all jumbled together. This tweak prints it better.

Signed-off-by: Tony Hansen [email protected]

---------

Signed-off-by: Tony Hansen [email protected]
  • Loading branch information
TonyLHansen authored Sep 3, 2024
1 parent 3be1012 commit 4472a11
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions docs/best_practices_modify.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/python3
# Modify bestpractices.coreinfrastructure.org project entries via API
# Modify www.bestpractices.dev project entries via API

# Copyright the Linux Foundation and the
# CII Best Practices badge contributors
Expand Down Expand Up @@ -62,8 +62,8 @@

# Plausible base URLs.
LOCAL_BASE_URL = 'http://localhost:3000/'
STAGING_BASE_URL = 'https://staging.bestpractices.coreinfrastructure.org/'
PRODUCTION_BASE_URL = 'https://bestpractices.coreinfrastructure.org/'
STAGING_BASE_URL = 'https://staging.bestpractices.dev/'
PRODUCTION_BASE_URL = 'https://www.bestpractices.dev/'

COOKIE_NAME = '_BadgeApp_session'

Expand Down Expand Up @@ -209,12 +209,21 @@ def write_to_project(base_url, id, updated_data, session_cookie):
auth_token, csrf_token, updated_session_cookie)
return status == 200

class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter):
"""
Show the epilog in a way that preserves the linebreaks.
Suggested at:
https://bugs.python.org/issue13023
"""
pass

def main():
"""Main entry for command line interface"""

# Create argument parser, then parse command line arguments with it.
parser = argparse.ArgumentParser(
description='Modify project data on BadgeApp',
formatter_class=CustomFormatter,
epilog=__doc__
)
parser.add_argument('-C', '--cookie',
Expand Down

0 comments on commit 4472a11

Please sign in to comment.