Skip to content

Commit

Permalink
1.1.0 (#5)
Browse files Browse the repository at this point in the history
Merge pull request #5 from Hexiro/development
  • Loading branch information
hexiro authored Oct 17, 2021
2 parents ec84379 + 84a4745 commit 623a153
Show file tree
Hide file tree
Showing 25 changed files with 1,321 additions and 1,151 deletions.
18 changes: 12 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
# ide settings
.idea/
.vscode/

# virtual environment
venv/

# python build stuff
__pycache__/
*.xml
*.pyc
autorequests.egg-info/
build/
*.py[cod]
*$py.class
dist/
reinstall.bat
build.bat

# pytest cache
.pytest_cache/
7 changes: 7 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## 🐞 Contributing

This project has a lot of room for improvement in optimizing regexps, better OOP, bug fixes, and completing todos. <br/>
If you make an issue, pr, or suggestion, it'll be very appreciated <3.

I'd prefer if you opened an issue before making a pull request with new features, <br/>
but if you find a bug and want to fix it, that can be opened whenever :))
394 changes: 21 additions & 373 deletions LICENSE

Large diffs are not rendered by default.

49 changes: 24 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,45 @@
# autorequests
# AutoRequests

Autorequests provides an easy way to create a simple API wrapper from request data generated by your browser.
AutoRequests provides an easy way to create a simple API wrapper from request data generated by your browser.

![BUILT WITH SWAG](https://forthebadge.com/images/badges/built-with-swag.svg)
![NOT A BUG A FEATURE](https://forthebadge.com/images/badges/not-a-bug-a-feature.svg)
![IT WORKS. WHY?](https://forthebadge.com/images/badges/it-works-why.svg)

### Showcase
### 📺 Demo

** the website shown in this example is [imperialb.in](https://imperialb.in)
![example showcase gif](https://i.imgur.com/75tMMIW.gif)

### Example Use Cases
### 💼 Example Use Cases

* Creating a foundation for an API wrapper
* Recreating a request outside the browser
* Testing what cookies or headers are required for a server to understand your request

### ✂️ How to Copy

1. Inspect Element
2. Go to `Network` tab
3. Find web request
4. Right-Click
5. Copy
6. Choose A `Copying Method`:

### Supported Copying Methods

* Powershell
* Node.JS fetch
1. Inspect Element
2. Go to `Network` tab
3. Find web request
4. Right-Click
5. Copy
6. Choose one of the following:
1. Powershell
2. Node.JS fetch

## 📦 Installation

install the package with pip

```
$ pip3 install autorequests
$ pip install autorequests
```

or download the latest development build from GitHub

```
$ pip3 install -U git+https://github.com/Hexiro/autorequests
$ pip install -U git+https://github.com/Hexiro/autorequests
```

## 🖥️ Command Line
Expand All @@ -62,25 +59,27 @@ generation options

```
--return-text Makes the generated method's responses return .text instead of .json()
--single-quote Uses single quotes instead of double quotes
--no-headers Removes all headers from the operation
--no-cookies Removes all cookies from the operation
--compare Compares the previously generated files to the new files
--parameters Replaces hardcoded params, json, data, etc with parameters that have default values
```

## 🚩 Known Issues

* Method names are parsed from the url, but if the URL doesn't have any paths with a valid method name, an invalid
method name will be used.
* Sometimes when copying fetches from the browser, some important headers aren't including, causing the resulting API
* Sometimes when copying from the browser, important headers aren't included which causes the resulting API
wrapper to fail requests.
* Parsing multipart/form-data when copying with the powershell mode isn't supported

## 📅 Planned Features
## 🐞 Contributing

* detecting base paths (like /api/v1) and setting that in the class constructor. (maybe).
see [CONTRIBUTING.md](./CONTRIBUTING.md)

## 🐞 Contributing

This project has a lot of room for improvement in optimizing regexps, better OOP, and bug fixes. If you make an issue,
pr, or suggestion, it'll be very appreciated <3.
## 📅 # TODO
* unit tests w/ pytest
* clean up cli
* replace ***--compare*** with ***--diff*** which shows diffs in console
* better output w/ rich
* possibly decouple method & class ?
3 changes: 2 additions & 1 deletion autorequests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from .__main__ import AutoRequests, main, __version__

__name__ = "autorequests"
__version__ = "1.0.2"
__description__ = "Automatically create a simple API wrapper from request data generated by your browser."
Loading

0 comments on commit 623a153

Please sign in to comment.