Make it installable
Fix missing LICENSE content
This commit is contained in:
parent
3194493e64
commit
39ec91620b
6 changed files with 57 additions and 5 deletions
19
LICENSE
19
LICENSE
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2023 Kumi Mitterer <trackingmore-api-tool@kumi.email>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
26
pyproject.toml
Normal file
26
pyproject.toml
Normal file
|
@ -0,0 +1,26 @@
|
|||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "trackingmore"
|
||||
version = "0.1.0"
|
||||
authors = [
|
||||
{ name="Kumi Mitterer", email="trackingmore-api-tool@kumi.email" },
|
||||
]
|
||||
description = "API wrapper for the TrackingMore API (v3)"
|
||||
readme = "README.md"
|
||||
license = { file="LICENSE" }
|
||||
requires-python = ">=3.8"
|
||||
classifiers = [
|
||||
"Programming Language :: Python :: 3",
|
||||
"License :: OSI Approved :: MIT License",
|
||||
"Operating System :: OS Independent",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
"Homepage" = "https://kumig.it/kumitterer/trackingmore-api-tool"
|
||||
"Bug Tracker" = "https://kumig.it/kumitterer/trackingmore-api-tool/issues"
|
||||
|
||||
[project.scripts]
|
||||
trackingmore = "trackingmore.tracker:main"
|
0
src/trackingmore/__init__.py
Normal file
0
src/trackingmore/__init__.py
Normal file
0
src/trackingmore/classes/__init__.py
Normal file
0
src/trackingmore/classes/__init__.py
Normal file
|
@ -1,12 +1,9 @@
|
|||
from classes.api import TrackingMore
|
||||
from trackingmore.classes.api import TrackingMore
|
||||
|
||||
from configparser import ConfigParser
|
||||
from argparse import ArgumentParser
|
||||
|
||||
if __name__ == "__main__":
|
||||
config = ConfigParser()
|
||||
config.read('settings.ini')
|
||||
|
||||
def main():
|
||||
parser = ArgumentParser()
|
||||
|
||||
parser.add_argument('tracking_number', nargs="?", help='Tracking number to track')
|
||||
|
@ -14,9 +11,13 @@ if __name__ == "__main__":
|
|||
parser.add_argument('--detect-carrier', '-d', action='store_true', help='Detect and output carrier from tracking number')
|
||||
parser.add_argument('--list-carriers', '-l', action='store_true', help='List carriers')
|
||||
parser.add_argument('--key', '-k', help='TrackingMore API Key (overrides config)')
|
||||
parser.add_argument('--config-file', '-f', help='Config file (default: settings.ini in working directory)', default='settings.ini')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
config = ConfigParser()
|
||||
config.read(args.config_file)
|
||||
|
||||
if (args.tracking_number or args.carrier) and args.list_carriers:
|
||||
print("Cannot specify both tracking number and --list-carriers/-l")
|
||||
exit(1)
|
||||
|
@ -36,3 +37,9 @@ if __name__ == "__main__":
|
|||
|
||||
else:
|
||||
print(api.track_shipment(args.tracking_number, args.carrier))
|
||||
|
||||
else:
|
||||
print("No tracking number specified - use --help for usage")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in a new issue