-
Notifications
You must be signed in to change notification settings - Fork 2
Initial Functionality Implementation #2
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
Changes from all commits
d21e003
5e656c4
c989d96
dde6e15
9b00ea9
4a27278
6848d0e
c71b71a
4945a2b
8c893c1
be15172
fed60c7
999e586
dfb8f93
00207ee
5635e2a
a988651
fa02dac
9f0088c
5d0486a
813be31
0383c77
11ac606
05ce989
9ac5dc5
7fc99db
b4c49d2
3499d5c
2c51f2b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o nounset | ||
set -o errexit | ||
set -o pipefail | ||
|
||
function usage { | ||
echo "Usage:" | ||
echo " ${0##*/} [options]" | ||
echo | ||
echo "Options:" | ||
echo " -h, --help Show the help message." | ||
echo " -l, --latest Pull down the latest release on GitHub." | ||
exit "$1" | ||
} | ||
|
||
# Defaults to a specific version for use in GitHub Actions | ||
DOWNLOAD_URL="https://github.com/adieuadieu/serverless-chrome/releases/download/v1.0.0-57/stable-headless-chromium-amazonlinux-2.zip" | ||
LOCAL_FILE="serverless-chrome.zip" | ||
LOCAL_DIR="tests/files/" | ||
|
||
|
||
# Get the URL of the latest stable release available | ||
function get_latest_stable_url { | ||
releases_url="https://api.github.com/repos/adieuadieu/serverless-chrome/releases" | ||
# Get the URL for the latest release's assets | ||
latest_assets=$(curl -s "$releases_url" | jq -r '.[0].assets_url') | ||
# Download the zip for the stable branch | ||
DOWNLOAD_URL=$(curl -s "$latest_assets" | jq -r '.[] | select(.browser_download_url | contains("stable")) | .browser_download_url') | ||
} | ||
|
||
while (( "$#" )) | ||
do | ||
case "$1" in | ||
-h|--help) | ||
usage 0 | ||
;; | ||
-l|--latest) | ||
get_latest_stable_url | ||
shift 1 | ||
;; | ||
-*) | ||
usage 1 | ||
;; | ||
esac | ||
done | ||
|
||
# Follow redirects and output as the specified file name | ||
curl -L --output "$LOCAL_FILE" "$DOWNLOAD_URL" | ||
# Extract the specified file to the specified directory and overwrite without | ||
# prompting | ||
unzip -o "$LOCAL_FILE" -d "$LOCAL_DIR" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
""" | ||
This is the setup module for the example project. | ||
This is the setup module for the hash-http-content project. | ||
|
||
Based on: | ||
|
||
|
@@ -42,16 +42,16 @@ def get_version(version_file): | |
|
||
|
||
setup( | ||
name="example", | ||
name="hash-http-content", | ||
# Versions should comply with PEP440 | ||
version=get_version("src/example/_version.py"), | ||
description="Example python library", | ||
version=get_version("src/hash_http_content/_version.py"), | ||
description="HTTP content hasher", | ||
long_description=readme(), | ||
long_description_content_type="text/markdown", | ||
# NCATS "homepage" | ||
url="https://www.us-cert.gov/resources/ncats", | ||
# The project's main homepage | ||
download_url="https://github.com/cisagov/skeleton-python-library", | ||
download_url="https://github.com/cisagov/hash-http-content", | ||
# Author details | ||
author="Cyber and Infrastructure Security Agency", | ||
author_email="ncats@hq.dhs.gov", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This email address needs to be updated upstream. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cisagov/skeleton-python-library#57 Did we reach a consensus on which of each to use? I'm happy to make an upstream PR to resolve this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see my comment at cisagov/skeleton-python-library#57 (comment). |
||
|
@@ -77,13 +77,20 @@ def get_version(version_file): | |
], | ||
python_requires=">=3.6", | ||
# What does your project relate to? | ||
keywords="skeleton", | ||
keywords="hash http requests", | ||
packages=find_packages(where="src"), | ||
package_dir={"": "src"}, | ||
package_data={"example": ["data/*.txt"]}, | ||
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")], | ||
include_package_data=True, | ||
install_requires=["docopt", "schema", "setuptools >= 24.2.0"], | ||
install_requires=[ | ||
"beautifulsoup4", | ||
"docopt", | ||
"lxml", | ||
"pyppeteer", | ||
"requests", | ||
"schema", | ||
"setuptools >= 24.2.0", | ||
], | ||
extras_require={ | ||
"test": [ | ||
"coverage", | ||
|
@@ -99,6 +106,6 @@ def get_version(version_file): | |
"pytest", | ||
] | ||
}, | ||
# Conveniently allows one to run the CLI tool as `example` | ||
entry_points={"console_scripts": ["example = example.example:main"]}, | ||
# Conveniently allows one to run the CLI tool as `hash-url` | ||
entry_points={"console_scripts": ["hash-url = hash_http_content.cli:main"]}, | ||
) |
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,12 @@ | ||
"""The example library.""" | ||
"""The hash-http-content library.""" | ||
# Standard Python Libraries | ||
from typing import List | ||
|
||
# We disable a Flake8 check for "Module imported but unused (F401)" here because | ||
# although this import is not directly used, it populates the value | ||
# package_name.__version__, which is used to get version information about this | ||
# Python package. | ||
from ._version import __version__ # noqa: F401 | ||
from .example import example_div | ||
from .hasher import UrlHasher, UrlResult | ||
|
||
__all__ = ["example_div"] | ||
__all__: List[str] = ["UrlHasher", "UrlResult"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"""Code to run if this package is used as a Python module.""" | ||
|
||
from .example import main | ||
from .cli import main | ||
|
||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This URL needs to be updated upstream.