├── .gitignore ├── CHANGELOG.md ├── LICENSE.md ├── README.md ├── examples ├── everything.http ├── get.http ├── loop.http └── test_cookie_and_post.http ├── grammar.txt ├── httplang.py ├── httplang ├── __init__.py ├── evaluate.py ├── global_data.py ├── make_request.py ├── parse.py ├── test.httpl └── tokenize.py ├── package-lock.json ├── requirements.txt ├── setup.py └── test.httpl /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | *.swo 4 | 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | *.py[cod] 8 | 9 | # C extensions 10 | *.so 11 | 12 | # Distribution / packaging 13 | .Python 14 | env/ 15 | build/ 16 | develop-eggs/ 17 | dist/ 18 | downloads/ 19 | eggs/ 20 | .eggs/ 21 | lib/ 22 | lib64/ 23 | parts/ 24 | sdist/ 25 | var/ 26 | *.egg-info/ 27 | .installed.cfg 28 | *.egg 29 | 30 | # PyInstaller 31 | # Usually these files are written by a python script from a template 32 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 33 | *.manifest 34 | *.spec 35 | 36 | # Installer logs 37 | pip-log.txt 38 | pip-delete-this-directory.txt 39 | 40 | # Unit test / coverage reports 41 | htmlcov/ 42 | .tox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *,cover 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | 57 | # Sphinx documentation 58 | docs/_build/ 59 | 60 | # PyBuilder 61 | target/ 62 | 63 | # OS X 64 | *.DS* 65 | 66 | # Test images 67 | *.jpg -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | Change Log 2 | ========== 3 | 4 | v0.1.0 5 | * Introduced loops 6 | * First official version 7 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Frankie Primerano 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | About 2 | ===== 3 | 4 | HTTPLang is a scripting language that makes writing HTTP request routines simpler. 5 | 6 | Current Version 7 | =============== 8 | 9 | 0.2.0 10 | 11 | What could I use it for? 12 | ==== 13 | 14 | - Testing APIs 15 | - Web Scraping 16 | - 17 | 18 | 19 | Installation 20 | ==== 21 | * Clone the repo 22 | * Run `python setup.py install` 23 | 24 | Usage 25 | === 26 | `httplang l` 27 | 28 | Documentation 29 | ============= 30 | 31 | Important Note 32 | -------------- 33 | 34 | HTTPLang is very strict about things like spaces. Make sure that your code matches the spacing and what not exactly as shown in the examples. If not there will be errors. 35 | 36 | Examples 37 | -------- 38 | 39 | 40 | ``` 41 | 42 | set URL "http://google.com" 43 | do GET "/ 44 | show RESPONSE 45 | 46 | ``` 47 | 48 | ``` 49 | set URL "http://google.com" 50 | label "loop" 51 | do GET / 52 | show STATUS 53 | goto "label" 54 | 55 | ``` 56 | 57 | ``` 58 | 59 | set URL "http://somesite.com" 60 | set POSTDATA "username=myUsername&password=myPassword is this" 61 | do POST "/login" 62 | set COOKIE TMPCOOKIE 63 | do GET "/usercp" 64 | 65 | ``` 66 | 67 | -------------------------------------------------------------------------------- /examples/everything.http: -------------------------------------------------------------------------------- 1 | set URL http://google.com/ 2 | do GET / 3 | set URL $URL 4 | set POSTDATA a=1,b=2,c=3,d=4 5 | set COOKIE $TMPCOOKIE 6 | do POST / 7 | -------------------------------------------------------------------------------- /examples/get.http: -------------------------------------------------------------------------------- 1 | set URL http://google.com/ 2 | do GET / 3 | show $HTML 4 | -------------------------------------------------------------------------------- /examples/loop.http: -------------------------------------------------------------------------------- 1 | set URL http://google.com 2 | loop 2 3 | do GET / 4 | show $STATUS 5 | endloop 6 | -------------------------------------------------------------------------------- /examples/test_cookie_and_post.http: -------------------------------------------------------------------------------- 1 | set URL http://localhost:5000/ 2 | do GET / 3 | set POSTDATA one=1,two=2 4 | do POST / 5 | set COOKIE $TMPCOOKIE 6 | do GET / 7 | -------------------------------------------------------------------------------- /grammar.txt: -------------------------------------------------------------------------------- 1 | := 2 | := 3 | := GET | POST | PUT | DELETE | PATCH 4 | := URL | TMPCOOKIE | COOKIE | HTML | POSTDATA | USERAGENT | STATUS | VALUE | LINKS 5 | := 6 | := 7 | := ( | | ) ( | | ) 8 |