-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add gender options for first names * add gender options for first names, random card * add job experience according to years of age * add parameter option for logging (not implemented yet) * add handpicked locations to cities in list * add float coords generation * add coordinates string formatting * fix ages in job level generation * start of unit tests * add more tests * add assertregex ussage in tests * fix missing imports * lint fixes * two lines padding before class
- Loading branch information
1 parent
c960b59
commit 7040dc5
Showing
41 changed files
with
1,768 additions
and
865 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
github : [codeperfectplus] | ||
custom: ["https://www.buymeacoffee.com/codeperfectplus"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
<a href="https://pypi.org/project/random-profile/"> | ||
Random Profile Generator | ||
</a> | ||
V2.0.0 | ||
V0.2.3 | ||
</h1> | ||
|
||
<h4 align="center">Python Module To Generate Random Profile Data</h4> | ||
|
@@ -19,34 +19,27 @@ | |
<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 | ||
|
||
Full Documentation is available at [ReadTheDocs](https://randomprofilegenerator.readthedocs.io/en/latest/) | ||
Documentation is available at [ReadTheDocs](https://randomprofilegenerator.readthedocs.io/en/latest/) | ||
|
||
## Upcoming Features | ||
|
||
- More Data Fields | ||
- More Data Types | ||
- Make it more user friendly and easy to use | ||
- Make it more efficient and faster | ||
- Cython Support | ||
- Support for more languages | ||
|
||
## Changelog | ||
|
||
|
@@ -58,14 +51,10 @@ 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import uvicorn | ||
from fastapi import FastAPI, Depends | ||
from fastapi.openapi.utils import get_openapi | ||
|
||
from pydantic import create_model | ||
from random_profile import RandomProfile | ||
|
||
# random_profile==0.2.3 required | ||
rp = RandomProfile() | ||
app = FastAPI() | ||
|
||
query_model = create_model("num", num=(int, ...)) | ||
api_version = "0.2.3" | ||
|
||
|
||
@app.get("/") | ||
def index(): | ||
return {"status": "200", | ||
"message": "Welcome to Random Profile Generator API", | ||
"version": api_version} | ||
|
||
|
||
@app.get('/api/v1/random_profile/full_profile') | ||
async def multiple_profile(params: query_model = Depends()): | ||
""" Get multiple profile with all details | ||
args: | ||
num (int): number of profiles to generate | ||
""" | ||
params_as_dict = params.dict() | ||
if params_as_dict['num'] > 100: | ||
return {"status": "400", | ||
"message": "Number of profiles should be less than 100", | ||
"version": api_version} | ||
|
||
num = params_as_dict['num'] | ||
profile = rp.full_profile(num) | ||
return profile | ||
|
||
|
||
@app.get('/api/v1/random_profile/first_name') | ||
async def multiple_first_name(params: query_model = Depends()): | ||
""" Get multiple first names | ||
args: | ||
num (int): number of first names to generate | ||
""" | ||
params_as_dict = params.dict() | ||
if params_as_dict['num'] > 100: | ||
return {"status": "400", | ||
"message": "Number of profiles should be less than 100", | ||
"version": api_version} | ||
|
||
num = params_as_dict['num'] | ||
first_names = rp.first_name(num) | ||
return first_names | ||
|
||
|
||
@app.get('/api/v1/random_profile/last_name') | ||
async def multiple_last_name(params: query_model = Depends()): | ||
""" Get multiple last names | ||
args: | ||
num (int): number of last names to generate | ||
""" | ||
params_as_dict = params.dict() | ||
if params_as_dict['num'] > 100: | ||
return {"status": "400", | ||
"message": "Number of profiles should be less than 100", | ||
"version": api_version} | ||
|
||
num = params_as_dict['num'] | ||
last_names = rp.last_name(num) | ||
return last_names | ||
|
||
|
||
@app.get('/api/v1/random_profile/full_name') | ||
async def multiple_full_name(params: query_model = Depends()): | ||
""" Get multiple full names | ||
args: | ||
num (int): number of full names to generate | ||
""" | ||
params_as_dict = params.dict() | ||
if params_as_dict['num'] > 100: | ||
return {"status": "400", | ||
"message": "Number of profiles should be less than 100", | ||
"version": api_version} | ||
|
||
num = params_as_dict['num'] | ||
|
||
full_names = rp.full_name(num) | ||
return full_names | ||
|
||
|
||
def custom_openapi(): | ||
if app.openapi_schema: | ||
return app.openapi_schema | ||
openapi_schema = get_openapi( | ||
title="Random Profile Generator API", | ||
version=api_version, | ||
description="Python Module To Generate Random Profile Data", | ||
routes=app.routes, | ||
) | ||
openapi_schema["info"]["x-logo"] = { | ||
"url": "https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" | ||
} | ||
app.openapi_schema = openapi_schema | ||
return app.openapi_schema | ||
|
||
|
||
app.openapi = custom_openapi | ||
|
||
if __name__ == "__main__": | ||
uvicorn.run(app, host="0.0.0.0", port=8000) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
random-profile==0.2.3 | ||
fastapi | ||
uvicorn |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Import as module | ||
---------------- | ||
------------ | ||
|
||
You can import the module and use it in your own scripts. | ||
|
||
|
Oops, something went wrong.