-
Notifications
You must be signed in to change notification settings - Fork 61
Create sample python package #801
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
3d56120
Start creating sample python package with https post request
caf9f00
Merge branch 'main' of https://github.com/elainechien/package-analysi…
fef51ae
decode output
49cbf07
Revise README and Makefile
b1db3b7
spelling
be1f0e6
Add https post request call to install and import phases
cd84b75
Remove requirements.txt
1055c07
Change function names to use underscores
9a65de1
Add newline
63600ff
Remove license and just defer to main package analysis license
6efe7f1
Merge branch 'main' into create_test_package
elainechien f956f03
Merge branch 'main' into create_test_package
calebbrown File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## Sample Python package | ||
|
||
This package will simulate different scenarios to test package analysis on. | ||
|
||
To use this package for local analysis, build this package by running | ||
`python3 -m build` in this directory. The package will be located in the dist/ | ||
folder. | ||
|
||
The same license for the rest of the package analysis project applies to this package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[build-system] | ||
elainechien marked this conversation as resolved.
Show resolved
Hide resolved
|
||
requires = ["setuptools", "setuptools-scm"] | ||
build-backend = "setuptools.build_meta" | ||
|
||
[project] | ||
name = "sample_python_package" | ||
version = "0.0.1" | ||
authors = [ | ||
{ name="OpenSSF <openssf-wg-securing-crit-prjs@lists.openssf.org>" }, | ||
] | ||
description = "A small example package" | ||
readme = "README.md" | ||
requires-python = ">=3.7" | ||
classifiers = [ | ||
"Programming Language :: Python :: 3", | ||
"License :: OSI Approved :: Apache Software License", | ||
"Operating System :: OS Independent", | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import sys | ||
import os | ||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
sys.path.append(SCRIPT_DIR) | ||
|
||
from setuptools import setup, find_packages | ||
from src.example import * | ||
|
||
setup(name="sample_python_package", | ||
packages=find_packages(),) | ||
|
||
send_https_post_request("setup.py") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import sys | ||
import os | ||
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
sys.path.append(SCRIPT_DIR) | ||
|
||
from example import * | ||
|
||
send_https_post_request("__init__.py") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import http.client | ||
import json | ||
|
||
# Sends an HTTPS post request and prints out the response. | ||
def send_https_post_request(location: str) -> None: | ||
host = "www.httpbin.org" | ||
conn = http.client.HTTPSConnection(host) | ||
data = {'text': 'Sending data through HTTPS from: ' + location} | ||
json_data = json.dumps(data) | ||
conn.request("POST", "/post", json_data, headers={"Host": host}) | ||
response = conn.getresponse() | ||
print(response.read().decode()) | ||
|
||
def main(): | ||
send_https_post_request("main function") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.