Skip to content

Commit

Permalink
rewrite w/ OOP (1.0.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiro committed May 28, 2021
1 parent c57635a commit 9ac82db
Show file tree
Hide file tree
Showing 14 changed files with 1,203 additions and 304 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
.idea/
Generations/
__pycache__/
*.xml
*.pyc
autorequests.egg-info/
reinstall.bat
build.bat
373 changes: 373 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# autorequests

Autorequests provides an easy way to create a simple API wrapper from 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

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

### Example Use Cases

* Creating a foundation for an API wrapper
* Testing what cookies / headers are required for a server to understand your request

### How to Copy Data

1. Do an action on a website that causes a web request to be sent.
2. Right-click --> Copy-As --> Node.JS Fetch

## 🖥️ Command Line

```console
$ autorequests --help
```

directory control

```console
-i, --input Input Directory
-o, --output Output Directory
```

parsing control

```
--no-headers Removes all headers from the operation
--no-cookies Removes all cookies from the operation
```

# 🚩 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
wrapper to fail requests.

# 📅 Planned Features

* converting camelCased method names to snake_case.
* replace hardcoded values with parameters that have default values.
* detecting base paths (like /api/v1) and setting that in the class constructor. (maybe).
* the ability to parse other formats of data from the browser (not just fetches).

# 🐞 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.
303 changes: 0 additions & 303 deletions autorequests.py

This file was deleted.

3 changes: 3 additions & 0 deletions autorequests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
__name__ = "autorequests"
__version__ = "1.0.0"
__description__ = "Automatically create a simple API wrapper from requests generated by your browser."
Loading

0 comments on commit 9ac82db

Please sign in to comment.