Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update best_practices_modify.py for bestpractices.dev #2161

Merged
merged 3 commits into from
Sep 3, 2024

Conversation

TonyLHansen
Copy link
Contributor

@TonyLHansen TonyLHansen commented Aug 28, 2024

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

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

The API modifier code never got updated for the bestpractices.dev URL change.
The epilog is all jumbled together. This tweak prints it better.

Signed-off-by: Tony Hansen [email protected]
@TonyLHansen
Copy link
Contributor Author

example of output without the CustomFormatter:

This program programmatically modifies BadgeApp projects. An example of using this on the command line is doc/best-practices-modify.py -S 1 '{"test_status": "Met"}' which modifies project 1 on the staging site. To modify the *production* site
data, use -P instead of -S. Updates use JSON format; remember to use double-quotes around all strings in the JSON format. Typically the JSON will modify criteria data; for a CRITERION, the status value is in field CRITERION_status nd the
corresponding text justification is in CRITERION_justification. A CRITERION_status can be Met, Unmnet, ?, or N/A. Note: For modification to work, you need to authenticate to the BadgeApp and provide that data to this program. Here's how.
First, use your web browser to log into the BadgeApp and get the value of the session cookie `_BadgeApp_session`. In Chrome, go to More Tools => Developer Tools => Application => Cookies, select the site, and select the _BadgeApp_session
cookie. In Firefox, go to Web Developer => Storage Inspector => Cookies. No matter what, select JUST the value of cookie `_BadgeApp_session` and copy it. One you have the cookie value copied into your clipboard, the recommended approach is to
set the environment variable _BadgeApp_session to it. E.g., in sh: export _BadgeApp_session='VALUE_FROM_CLIPBOARD' Alternatively, you can pass the session value on the command line, by using the -C argument (-C *session_cookie_value*). Note
that a given login cookie is good for 48 hours, and then expires. When used as a library, the two functions to use are best_practices_modify.write_to_project() and best_practices_modify.patch_project(). In addition, these string constants may
be useful: best_practices_modify.COOKIE_NAME, best_practices_modify.PRODUCTION_BASE_URL, best_practices_modify.STAGING_BASE_URL, and best_practices_modify.LOCAL_BASE_URL.

Example with the formatter:

This program programmatically modifies BadgeApp projects.

An example of using this on the command line is
doc/best-practices-modify.py -S 1 '{"test_status": "Met"}'
which modifies project 1 on the staging site.
To modify the *production* site data, use -P instead of -S.
Updates use JSON format; remember to use double-quotes around all strings
in the JSON format. Typically the JSON will modify criteria data; for
a CRITERION, the status value is in field CRITERION_status
nd the corresponding text justification is in CRITERION_justification.
A CRITERION_status can be Met, Unmnet, ?, or N/A.

Note: For modification to work, you need to authenticate to the BadgeApp
and provide that data to this program. Here's how.

First, use your web browser to log into
the BadgeApp and get the value of the session cookie `_BadgeApp_session`.
In Chrome, go to
More Tools => Developer Tools => Application => Cookies,
select the site, and select the _BadgeApp_session cookie.
In Firefox, go to Web Developer => Storage Inspector => Cookies.
No matter what, select JUST the value of cookie `_BadgeApp_session`
and copy it.
. . .

@david-a-wheeler
Copy link
Collaborator

You're absolutely right! Thanks for the fixes!

@david-a-wheeler david-a-wheeler merged commit 4472a11 into coreinfrastructure:main Sep 3, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants