Skip to content

Commit

Permalink
Merge pull request #2 from gcmalloc/add_python_linter
Browse files Browse the repository at this point in the history
retrying the linter with a more specific path
  • Loading branch information
gcmalloc committed Sep 16, 2020
2 parents 96fb965 + e63d393 commit 6d644b9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pr_to_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ jobs:
- uses: jpetrucciani/black-check@master
with:
path: '.'
path: "importer/"
24 changes: 11 additions & 13 deletions importer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,7 @@

def post(user, password, file_path):
url = "http://localhost:8000/geoserver/rest/imports"
payload = {
"import": {
"targetWorkspace": {
"workspace": {
"name": "enermaps"
}
},
}
}
payload = {"import": {"targetWorkspace": {"workspace": {"name": "enermaps"}}}}
session = requests.Session()
session.auth = (user, password)
resp = session.post(url, json=payload)
Expand All @@ -29,15 +21,18 @@ def post(user, password, file_path):
with open(file_path) as shapefile:
resp = session.post(url, files={"name": filename, "filedata": shapefile})
print(resp, resp.text)
resp = session.post("http://localhost:8000/geoserver/rest/imports/{!s}".format(import_id))
resp = session.post(
"http://localhost:8000/geoserver/rest/imports/{!s}".format(import_id)
)
print(resp, resp.text)



def get_parser():
"""return the cli command parser
"""
parser = argparse.ArgumentParser(__name__, description="import a raster into a geoserver")
parser = argparse.ArgumentParser(
__name__, description="import a raster into a geoserver"
)
parser.add_argument("-u", "--user", default="admin")
parser.add_argument("shapefile")
return parser
Expand All @@ -48,7 +43,10 @@ def main():

parser = get_parser()
args = parser.parse_args()
post(user=args.user, password=os.environ['GEOSERVER_PASS'], file_path=args.shapefile)
post(
user=args.user, password=os.environ["GEOSERVER_PASS"], file_path=args.shapefile
)


if __name__ == "__main__":
main()

0 comments on commit 6d644b9

Please sign in to comment.