An awesome opensource project for adding custom dynamic methods and functionality for Built-in Data Types!
Creating general modules for repetative tasks. (Which have a potential of being an project in itself 😉)
Table of Contents
There are many great opensource projects available on GitHub; however, I didn't find one that really suited my needs so I created this enhanced one. I want to create a python package which can add dynamic functionaities to built in types. Also to club general repetative task as a form of automation or method.
Here's why:
- We Pythoner's daily write awesome code and sometime surprice ourself with a method or script created by ourself realizing this can be used again or is just to awesome!
- These can be your implmentation for slicing, scraping, printing, etc.. But all the ideas can be categorized into some umbrella like slicing will be for list/strings; scrapping; Extracting keywords from string...
- This repository is that umbrella
Of course, no one package will serve all projects since your needs may be different. So I'll be adding more modules in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue. Thanks to all the people in advance planning to contribute or to expand this repo!
Use the Documentation
to get started.
This section should list any major frameworks/libraries used to bootstrap your project. Leave any add-ons/plugins for the acknowledgements section. Here are a few examples.
Most of the modeules are standalone but for few make require some additional packages which will taken care up by PIP.
You need python 3 and any IDE installed. To install python:
Go to https://www.python.org/downloads/ and download any 3.x version for python
Install the package using PYPI (pip)
pip install makeitlitt
- For Stackoverflow module:
To get the stack overflow results for the query we search daily for confirmation 😁
module name: stackoverflow
Import:
from makeitlitt import stackoverflow
Method name: get_stackoverflow_result(query, limit=2, **parameters)
Method Documentation:
Method to show stack overflow results.
Parameters:
query [STRING]: stack overflow query to search
limit [INT]: Number of answers to display per page (DEFAULT - 2)
Optional keyword arguments::
@ans_format [INT]:
> 0 - Display only code snippets from answer (DEFAULT)
> 1 - Display detailed answer
@result [INT]:
> 0 [DEFAULT] - To print the result
> 1 - To get search_result {DICTIONARY} as return for search result
> 2 - Get result as key:value pair data with raw inputs and only formated answer body
Verified [BOOL] | (Under development) :
<TRUE> - To display only the Verified Accepted Correct Answer on the Stack overflow page.
<FALSE> - To display all the result within the limit. [DEFAULT]
Return:
search_result {DICTIONARY}:
> 'result_title': [STRING] <Title of the Result>
> 'page-n': [STRING] <page_data>, Where 'n' is page number & page_data is formated page result
> 'pages': [INT] <Number of pages in result>
Examples:
- To print results of code snippets from stack overflow for mention query
from makeitlitt import stackoverflow as sf
sf.get_stackoverflow_result("list slicing in python")
- To get all the raw scrapped data as a dictionary
from makeitlitt import stackoverflow as sf
search_results_snippets = sf.get_stackoverflow_result("list slicing in python",result=2) #Gets only code snippets from the answer
search_results_detailed = sf.get_stackoverflow_result("list slicing in python",ans_format=1,result=2) #Gets detailed long answer
- For fetching all the search result URLs on Google search engine for a search query:
To get the URL search results for the query to perform scrapping, SEO analysis or any other user case.
module name: stackoverflow
Import:
from makeitlitt import stackoverflow
Method name: get_google_searchResult_Links(query, domain_name=0)
Method Documentation:
Method to get URL results from google search engine
Parameters:
query [STRING]: Query to search.
domain [STRING]: To filter the result based on a particular website.
[Default]: 0 --> Get All results irrespective of domain name
Return:
result_links [List]:
[...,] - Result Urls scraped for the search page
[-1] - If no result found for filtered website with requested query
[0] - If no result found on the Internet
Examples:
- To get all the URLs of searched query as result
from makeitlitt import stackoverflow as sf
sf.get_google_searchResult_Links("How to create a pancake?")
- To get all the URLs of searched query from a particular domain
from makeitlitt import stackoverflow as sf
sf.get_google_searchResult_Links("How to create a dictionary in python?", domain_name="stackoverflow.com")
- Scrap data from each URL
- Get question and question vote count
- Check total Answers present in page
- Argumrents to get detailed or summarized results [flag]
- Check for exceptions and internet connection
- Create snippet result for a quick view for user
- ADD method to print snippet in a box.
- ADD 'result' [Optional Parameter] - [INT] to get the complete output as a STRING, instead of printing result
- Store complete print in a List[..,answer_pages] named 'search_result' and then later join as String to print/return just as implemented in 'text_in_box()' method.
- ADD 'verified' [Optional Parameter] as an optional parameter to only display the verified answer from the page
- Unittesting
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Linkdln - @Siddharth Verma - artistwhocode7@protonmail.com
Discord: Siddharth#3469