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

updating cli #48

Merged
merged 11 commits into from
Nov 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
python -m pip install --upgrade pip
pip install flake8
- name: Lint with flake8
run: flake8 . --isolated --exclude=.cache,.venv,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,**/migrations/** --ignore=E203,W503,E501,F401
run: flake8 . --isolated --exclude=.cache,.venv,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,**/migrations/** --ignore=E501,E402
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file. The format

## Changelog

## [1.0.1] -

- server can be start from cli
- More Endpoints exposed to the API/CLI
- Code refactored


## [1.0.0] - 05-11-2022

- Beautiful command line output
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ We love your input! We want to make contributing to this project as easy and tra

- Create a PR from our repo on Github.

### Run Flake8

```sh
flake8 . --isolated --ignore=E501,E402
```

### Additional Notes

- Any changes should be made in the `dev` branch.
Expand Down
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<a href="https://pypi.org/project/random-profile/">
Random Profile Generator
</a>
V1.0.0
V1.0.1
</h1>

<h4 align="center">Python Module To Generate Random Profile Data</h4>
Expand All @@ -19,27 +19,34 @@
<img src="https://img.shields.io/pypi/dw/random-profile.svg">
<img src="https://img.shields.io/pypi/dm/random-profile.svg">
</p>
<p align="center">
<p align="center">

<img alt="GitHub pull-requests" src="https://img.shields.io/github/issues-pr/Py-Contributors/RandomProfileGenerator">

<img alt="GitHub forks" src="https://img.shields.io/github/forks/Py-Contributors/RandomProfileGenerator">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/Py-Contributors/RandomProfileGenerator">

<img alt="contributors" src="https://img.shields.io/github/contributors/Py-Contributors/RandomProfileGenerator">
<img alt="contributors" src="https://img.shields.io/github/contributors/Py-Contributors/RandomProfileGenerator">

<img alt="GitHub stars" src="https://img.shields.io/github/stars/Py-Contributors/RandomProfileGenerator"> </p>


[RandomProfile](https://pypi.org/project/random-profile/) is a powerful and simple tool to generate fake data. You can use it to mock classes, populate databases and much more. You can check the full documentation here. Check on [Pypi](https://pypi.org/project/random-profile/)

```sh
pip install random-profile
```

## Documentation

Documentation is available at [ReadTheDocs](https://randomprofilegenerator.readthedocs.io/en/latest/)
Full Documentation is available at [ReadTheDocs](https://randomprofilegenerator.readthedocs.io/en/latest/)

## Upcoming Features

- Support for more languages
- More Data Fields
- More Data Types
- Make it more user friendly and easy to use
- Make it more efficient and faster
- Cython Support

## Changelog

Expand All @@ -51,10 +58,14 @@ Check the [Contributing](/CONTRIBUTING.md) for the contribution guidelines.

## License

The project is licensed under the <a href="/LICENSE">MIT</a> license.
The project is licensed under the <a href="/LICENSE">MIT</a> license.

## Contributors

<a href="https://github.com/codePerfectPlus/awesomeScripts/graphs/contributors">
<img src="https://contrib.rocks/image?repo=codePerfectPlus/randomprofilegenerator" />
</a>

## Sponsor

Email: [Pycontributors](mailto:[email protected]) for sponsorship details.
118 changes: 0 additions & 118 deletions api/api.py

This file was deleted.

3 changes: 0 additions & 3 deletions api/requirements.txt

This file was deleted.

Binary file added docs/assets/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 27 additions & 21 deletions docs/command_line_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,81 +9,87 @@ Usages:

.. code-block:: bash

random-profile --help
Usage: random-profile [OPTIONS]
rp --help or random_profile -h
Usage: rp [OPTIONS]

random-profile -n 10 -p
rp -n 10 -p

optional arguments:
-h, --help show this help message and exit
-n N Number of random profiles

-f, --fullname Get full name instead of first name
-p, --profile Get full profile instead of first name
-l, --lastname Get last name instead of first name
-ip, --ipv4 Get an ipv4 IP address
-j, --jobtitle Get job title

-h, --help show this help message and exit
-v, --version show program's version number and exit
--server Start server
--port PORT Port number
-n N Number of random profiles
-p, --profile Get full profile
-f, --firstname Get first name
-l, --lastname Get last name instead of first name
--fullname Get full name instead of first name
--ip Get an ipv4 IP address
--job Get job title
--address Get address

Get Random Profile:
-------------------

.. code-block:: bash

# n = number of random profiles, p = profile
random_profile -n 10 -p
rp -n 10 -p

Get First Name:
---------------

.. code-block:: bash

# n = number of random profiles, f = first name
random_profile -n 10 -f
rp -n 10 -f

Get Last Name:
--------------

.. code-block:: bash

# n = number of random profiles, l = last name
random_profile -n 10 -l
rp -n 10 -l

Get Job Title:
--------------

.. code-block:: bash

# n = number of random profiles, j = job title
random_profile -n 10 -j
rp -n 10 -j

Get IPv4 Address:
-----------------

.. code-block:: bash

# n = number of random profiles, ip = ipv4
random_profile -n 10 -ip
rp -n 10 -ip


Get Random Profile and Save to File:
------------------------------------

.. code-block:: bash

# n = number of random profiles, p = profile
random_profile -n 10 -p > random_profiles.txt
rp -n 10 -p > rps.txt

.. code-block:: bash

# save to a file
# n = number of random profiles, p = profile
random_profile -n 10 -p >> random_profiles.txt
rp -n 10 -p >> rps.txt


Get Random Profile version:
---------------------------

.. code-block:: bash

random_profile --version
rp --version

rp 0.2.3

random-profile 0.2.3
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
project = 'Random Profile Generator'
description = 'A random profile generator for testing purposes.'
author = 'Deeapk Raj'
release = '0.2.3'
release = '1.0.1'
year = datetime.now().year
copyright = "{} Deepak Raj".format(year)
source_suffix = ".rst"
Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Contents:
installation.rst
command_line_usage.rst
import_as_module.rst
run_as_server.rst
changelog.rst
roadmap.rst
run_test_cases.rst
Expand Down
2 changes: 1 addition & 1 deletion docs/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Use cases
- Mocking classes
- Populating databases
- Generating test data
- Generating fake data for your application
- Generating fake data for Cybersecurity
- Generating fake data for your tests
- Generating fake data for your documentation
- Generating fake data for your presentation
Expand Down
30 changes: 30 additions & 0 deletions docs/run_as_server.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Run as server
=============

To run as a server, you need to specify the port to listen on:


.. code-block:: bash

default port is 8000
$ rp --server --port 8080

This will start a server on port 8080. You can then use the client to connect to it:

Test it with postman

.. code-block:: bash

$ curl -X GET http://localhost:8080/ -H 'Content-Type: application/json'

Interactive Api Documentation

`http://localhost:<port>/docs`

API Endpoints
-------------

`localhost:8000/api/v1/random_profile/full_profile?num=10`
`localhost:8000/api/v1/random_profile/first_name?num=10`
`localhost:8000/api/v1/random_profile/last_name?num=10`
`localhost:8000/api/v1/random_profile/full_name?num=10`
Loading