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

0.0.9 #36

Merged
merged 147 commits into from
Mar 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
51d916b
prog name
cedric05 Feb 4, 2021
4c01aaa
better error reporting
cedric05 Feb 4, 2021
c16164c
added logging for better tracking
cedric05 Feb 4, 2021
1d20633
in middle of json
cedric05 Feb 4, 2021
df18ea8
more tasks
cedric05 Feb 4, 2021
0b84761
json payload complete
cedric05 Feb 4, 2021
2123b26
in middle of adding tests
cedric05 Feb 5, 2021
8188dec
allow comments in json for property file
cedric05 Feb 5, 2021
cf46e37
added few simple test cases.
cedric05 Feb 5, 2021
31b8903
json test cases. need to add substituion tests
cedric05 Feb 5, 2021
e136010
`python -m unittest` will test all
cedric05 Feb 5, 2021
0e305f2
substitution tests complete. need to work on json comments.
cedric05 Feb 5, 2021
a4eb84c
substitution tests complete
cedric05 Feb 6, 2021
e4ea127
few fixes
cedric05 Feb 6, 2021
3695f6b
added placeholder for tests.
cedric05 Feb 6, 2021
f4acb9b
added placeholder for tests.
cedric05 Feb 6, 2021
962953f
fix bugs found by tests
cedric05 Feb 7, 2021
7fccbd3
info logs
cedric05 Feb 7, 2021
b39af20
command line property error
cedric05 Feb 7, 2021
e8e9527
basic auth, cookie
cedric05 Feb 7, 2021
3907164
in middle of installable package
cedric05 Feb 7, 2021
661be4e
dothttp-cli installable package, single file, folder
cedric05 Feb 7, 2021
faf54bd
docker publish to github
cedric05 Feb 7, 2021
a3913bb
update workflow
cedric05 Feb 7, 2021
543f4ec
fix name
cedric05 Feb 7, 2021
b5e78a3
release to github
cedric05 Feb 7, 2021
4cb6c22
formatter
cedric05 Feb 7, 2021
51cf8a6
Merge branch 'master' of github.com:cedric05/dothttp into dev
cedric05 Feb 7, 2021
1abb480
fix tests
cedric05 Feb 7, 2021
2ee33aa
json format fix
cedric05 Feb 7, 2021
3ca354c
stdout for formatting. grouping commandline args.
cedric05 Feb 7, 2021
728b53e
- default headers defined in prop file
cedric05 Feb 7, 2021
daf6143
fixed few tasks from #4
cedric05 Feb 7, 2021
cce9a22
fix formatting for data section when input is json
cedric05 Feb 7, 2021
cb7eac4
in middle of pyoxidizer
cedric05 Feb 8, 2021
47ca9c3
property validation, json file validation, cookie save failure proceed
cedric05 Feb 9, 2021
9e00f6a
whitespace is ignored, unless specified in quotes.
cedric05 Feb 9, 2021
d854def
readme and bug fix for propertys
cedric05 Feb 9, 2021
a49cc62
Merge branch 'master' of github.com:cedric05/dothttp into dev
cedric05 Feb 9, 2021
c8bac1b
add few unit tests
cedric05 Feb 9, 2021
07a9e43
add tests, few are more direct need to add more assertions
cedric05 Feb 10, 2021
7ad881f
test output of curl and formatter.
cedric05 Feb 10, 2021
e3aa806
Update Dockerfile
cedric05 Feb 10, 2021
858ce78
using multiple files, pyinstaller, workable in most unix
cedric05 Feb 10, 2021
dc20348
windows docker file
cedric05 Feb 10, 2021
37cba7a
formatter has issues with comments. need to rewrite from beginning
cedric05 Feb 11, 2021
fba27ef
few formatting fixes
cedric05 Feb 11, 2021
8194341
extension link
cedric05 Feb 11, 2021
50f5a75
pipfile
cedric05 Feb 11, 2021
e056b14
bugs reporting
cedric05 Feb 11, 2021
9f04e91
fix query params bug
cedric05 Feb 11, 2021
7a23b1a
added substituion tests
cedric05 Feb 11, 2021
58acf92
fix bugs found via test cases
cedric05 Feb 11, 2021
801c32c
Merge branch 'master' of github.com:cedric05/dothttp into dev
cedric05 Feb 12, 2021
f94f7c0
bug with multiple substitutions
cedric05 Feb 12, 2021
e3b824e
Merge branch 'dev' of dothttp-git.org:cedric05/dothttp into dev
cedric05 Feb 12, 2021
cddd387
print output path
cedric05 Feb 12, 2021
c304828
experimental phase, of string matching
cedric05 Feb 12, 2021
d83bf3a
alphanumeric then write normally otherwise go for double or single qu…
cedric05 Feb 12, 2021
28b8dce
http file issue
cedric05 Feb 12, 2021
313b1ed
fix github actions
cedric05 Feb 12, 2021
a7dcfab
Update TASKS.md
cedric05 Feb 14, 2021
4085c89
formatter has issues with comments. need to rewrite from beginning
cedric05 Feb 14, 2021
5ffdb4a
Merge branch 'dev' of github.com:cedric05/dothttp into dev
cedric05 Feb 14, 2021
a03cfb0
update version
cedric05 Feb 14, 2021
646b7e4
setup.py fix requirements, add console package
cedric05 Feb 14, 2021
cf7c117
setup.py fix requirements, add console package
cedric05 Feb 14, 2021
2e903f9
Merge branch 'dev' of github.com:cedric05/dothttp into dev
cedric05 Feb 14, 2021
dc315c0
update README.md
cedric05 Feb 14, 2021
174e8c9
Merge branch 'master' of github.com:cedric05/dothttp into dev
cedric05 Feb 14, 2021
ba76f07
platform specific
cedric05 Feb 14, 2021
5c793a4
platform specific
cedric05 Feb 14, 2021
f2346b5
next steps
cedric05 Feb 15, 2021
ee841eb
initial extension phase
cedric05 Feb 15, 2021
b13e111
added error handling in response
cedric05 Feb 16, 2021
3018e84
naming requests, only useful in ide
cedric05 Feb 16, 2021
6ef861b
multiple requests in same file, although i prefer not to have in that…
cedric05 Feb 18, 2021
a3de749
fix exception message
cedric05 Feb 18, 2021
2293741
trailing ',' are allowed now in data and json. so, no problem comment…
cedric05 Feb 18, 2021
0bcf115
add license (#8)
cedric05 Feb 19, 2021
3be22a9
calling http.http is bad, changed it to urlwrap and adding trailing '…
cedric05 Feb 19, 2021
82f7048
on error, return error. flush right after writing to cmdline (helpful…
cedric05 Feb 19, 2021
934c664
added error handling in response
cedric05 Feb 20, 2021
77cd02a
Merge branch 'dev' of github.com:cedric05/dothttp into dev
cedric05 Feb 20, 2021
1c047a6
fix conflicsts
cedric05 Feb 20, 2021
5820e9b
target tests
cedric05 Feb 21, 2021
53e2b2f
better messaging
cedric05 Feb 21, 2021
621d5b2
trailing commas are ok with dothttp [tests]
cedric05 Feb 21, 2021
889f28b
added tests to commands
cedric05 Feb 21, 2021
2c4f00e
[bug] target id starts with 0
cedric05 Feb 22, 2021
29f2b71
allow curl
cedric05 Feb 24, 2021
14fd5e2
tasks
cedric05 Feb 24, 2021
3fdc9b8
threading
cedric05 Feb 24, 2021
3d34844
multi line curl and easy sharable file
cedric05 Feb 26, 2021
403e8f5
check for similar names
cedric05 Feb 26, 2021
6c93c38
added resources
cedric05 Feb 26, 2021
75d5abb
fix tests
cedric05 Feb 26, 2021
e82f4e0
validate name is working now
cedric05 Feb 26, 2021
c2550e7
fix multipart payload with actual data
cedric05 Feb 26, 2021
8e6aa33
using typings for models, helpful for debugging and working
cedric05 Feb 26, 2021
7dd4503
add models
cedric05 Feb 26, 2021
4142627
added tests for more scenarios
cedric05 Feb 27, 2021
f27a905
Merge branch 'main' of github.com:cedric05/dothttp into dev
cedric05 Feb 27, 2021
813152a
better example
cedric05 Feb 27, 2021
3d64987
Merge branch 'main' of github.com:cedric05/dothttp into dev
cedric05 Feb 27, 2021
1d430aa
update version
cedric05 Feb 27, 2021
fcb3f15
update version
cedric05 Feb 27, 2021
61ee190
Update README.md
cedric05 Feb 27, 2021
6757d83
Merge branch 'cedric05-patch-1' of dothttp-git.org:cedric05/dothttp i…
cedric05 Feb 27, 2021
195f26c
variable need not have to be defined first time
cedric05 Feb 28, 2021
c51ea33
Merge branch 'dev' of github.com:cedric05/dothttp into dev
cedric05 Feb 28, 2021
a5b105c
Merge branch 'main' of github.com:cedric05/dothttp into dev
cedric05 Feb 28, 2021
48309d7
install flask only when needed, os specific tests
cedric05 Mar 1, 2021
1dbf9d7
postman import complete. currently file creation is done in server side
cedric05 Mar 3, 2021
b10d61c
Fixes #21 #22 #18 #23
cedric05 Mar 3, 2021
26def7e
postman unquote values
cedric05 Mar 5, 2021
2a5f8e9
swagger schema
cedric05 Mar 5, 2021
e3af759
var string
cedric05 Mar 5, 2021
58174c0
var string
cedric05 Mar 5, 2021
3ed8798
fix todos
cedric05 Mar 5, 2021
4a5e114
move json parsing out of core logic
cedric05 Mar 5, 2021
6645adf
fix json key var
cedric05 Mar 5, 2021
b3a4a1d
added test and fixes #27 #28
cedric05 Mar 6, 2021
60714e1
Merge pull request #29 from cedric05/properties_perhttp
cedric05 Mar 6, 2021
0ab8571
#15 postman improvements
cedric05 Mar 6, 2021
d354958
libmagic is not must
cedric05 Mar 6, 2021
d0ec66a
goal rewamp
cedric05 Mar 6, 2021
a7a9f2a
Merge branch 'dev' of dothttp-git.org:cedric05/dothttp into dev
cedric05 Mar 6, 2021
bb9e602
generate http from requests
cedric05 Mar 6, 2021
b44f4e6
fix line endings
cedric05 Mar 6, 2021
6610eb5
fix $
cedric05 Mar 6, 2021
bbb9ad9
fix readme
cedric05 Mar 6, 2021
17bcb49
version update
cedric05 Mar 6, 2021
e5bec29
send updated http def
cedric05 Mar 6, 2021
8bbd70c
subs test on each section.
cedric05 Mar 6, 2021
f3ac7fa
remove flask
cedric05 Mar 7, 2021
1a6e31f
update
cedric05 Mar 7, 2021
ab89f20
#24 provide random properties complete. adding tests pending
cedric05 Mar 17, 2021
28d632c
example update
cedric05 Mar 17, 2021
2dc3cdc
update version and schema
cedric05 Mar 17, 2021
7638006
added tests for random
cedric05 Mar 18, 2021
2a1076f
fixes #32
cedric05 Mar 18, 2021
072da0c
allow properties to have more than one equals
cedric05 Mar 18, 2021
79e970a
[Feature] allow env variables to have json vaule #33
cedric05 Mar 18, 2021
a485549
fix tests
cedric05 Mar 19, 2021
476c6a4
added tests for env with json structure
cedric05 Mar 19, 2021
bdaa2e8
Merge branch 'main' of dothttp-git.org:cedric05/dothttp into dev
cedric05 Mar 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
179 changes: 0 additions & 179 deletions dotextensions/server.py

This file was deleted.

44 changes: 29 additions & 15 deletions dotextensions/server/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import requests
from requests import PreparedRequest

from dothttp import RequestCompiler, Config, DotHttpException, dothttp_model, CurlCompiler, HttpFileFormatter
from dothttp import RequestCompiler, Config, DotHttpException, dothttp_model, CurlCompiler, HttpFileFormatter, HttpDef
from dothttp.parse_models import Http, Allhttp, UrlWrap, BasicAuth, Payload, MultiPartFile, FilesWrap, Query, Header, \
NameWrap, Line
from . import Command, Result, BaseHandler
Expand Down Expand Up @@ -47,7 +47,6 @@ def run(self, command: Command) -> Result:
})
else:
comp = RequestCompiler(config)
request = comp.get_request()
resp = comp.get_response()
response_data = {
"response": {
Expand All @@ -57,17 +56,10 @@ def run(self, command: Command) -> Result:
"status": resp.status_code, }
}
# will be used for response
request_data = {"request": {
"url": request.url,
"body": request.body,
"headers": request.headers,
"method": request.method,
}}
data = {}
data.update(response_data['response']) # deprecated
# data.update(request_data)
data.update(response_data)
# data.update({"http": self.get_http_from_req(request)})
data.update({"http": self.get_http_from_req(comp.httpdef)})
result = Result(id=command.id,
result=data)
except DotHttpException as ex:
Expand All @@ -77,17 +69,39 @@ def run(self, command: Command) -> Result:
return result

@staticmethod
def get_http_from_req(request: PreparedRequest):
def get_http_from_req(request: HttpDef):
data = None
datajson = None
file = None
json_payload = None
fileswrap = None
type = None
if request.payload.filename:
file = request.payload.filename
elif isinstance(request.payload.data, str):
data = request.payload.data
elif isinstance(request.payload.data, dict):
datajson = None
elif request.payload.json:
json_payload = request.payload.json
elif request.payload.files:
fileswrap = FilesWrap([])
for filekey, multipartdata in request.payload.files:
fileswrap.files.append(
MultiPartFile(name=filekey,
path=multipartdata[1].name if multipartdata[0] else multipartdata[1],
type=multipartdata[2] if len(multipartdata) > 2 else None)
)

payload = Payload(data=data, datajson=datajson, file=file, json=json_payload, fileswrap=fileswrap, type=type)
return HttpFileFormatter.format(Allhttp(allhttps=[Http(
namewrap=None,
namewrap=NameWrap(request.name),
urlwrap=UrlWrap(url=request.url, method=request.method),
lines=[
Line(header=Header(key=key, value=value), query=None)
for key, value in
request.headers.items()],
payload=Payload(data=request.body, datajson=None,
file=None, json=None, fileswrap=None,
type=None),
payload=payload,
output=None, basic_auth_wrap=None
)]))

Expand Down
5 changes: 2 additions & 3 deletions dotextensions/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
from json import JSONDecodeError
from typing import Dict

from flask import Flask
from flask import request

from . import Command, BaseHandler
from .commands import RunHttpFileHandler, FormatHttpFileHandler, GetNameReferencesHandler, ImportPostmanCollection

Expand Down Expand Up @@ -40,6 +37,7 @@ def get_command(self, **kwargs):

class HttpServer(Base):
def __init__(self, port=5000):
from flask import Flask
app = Flask("dothttp-server")
self.app = app
self.port = port
Expand All @@ -52,6 +50,7 @@ def run_forever(self):

def get_handler(self, handler):
def flask_api_handler():
from flask import request
try:
id = int(request.args['id'])
command = {'method': handler, 'params': json.loads(request.data), 'id': id}
Expand Down
21 changes: 21 additions & 0 deletions dotextensions/server/symbols/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from typing import Optional

from dothttp import RequestCompiler


class allkey(dict):
def get(self, key: str) -> Optional:
ret_val = super().get(key)
if (ret_val):
return ret_val
return ''


class FetchNames(RequestCompiler):

def load(self):
self.load_content()
props = self.get_declared_props()
for prop in props:
self.properties[prop] = '""'
super().load()
Loading