Welcome to py_everything’s Documentation!

Welcome to the Documentation for py_everything. You can find all the modules and how to use them here.

py_everything hopes to become a Python package that helps you write everything much faster and in a easier way.

Power of py_everything -

The basic usage for this package is given below:

>>> import py_everything
>>> from py_everything import search
>>> search.search_files('python', 'C:\Programming\\')
C:\Programming\python.txt
C:\Programming\projectpython.py
C:\Programming\py_everything-python.docx
>>> my_list = [2, 4, 5, 3, 7, 5, 6, 3 , 12 , 9, 6]
>>> py_everything.maths.avg(my_list)
5.636363636363637

Contributors -

People who have contributed to this project -

Modules, Functions, and Classes

Detailed Package List

Modules:
  • py_everything

  • py_everything.automation

  • py_everything.date_utils

  • py_everything.fileIO

  • py_everything.maths

  • py_everything.requestsLib

  • py_everything.search

  • py_everything.web

Functions:
py_everything:
  • hello_world

  • print_no_newline

  • clearPycache

  • install_modules

py_everything.automation:
  • email_bot

  • email_address_slicer

  • yt_downloader

  • roll_dice

  • timer

py_everything.date_utils:
  • get_date

  • get_date_time

  • get_time

  • get_custom_format

py_everything.fileIO:
  • read_file

  • write_file

  • clear_file

py_everything.maths:
  • add

  • subtract

  • multiply

  • divide

  • float_div

  • int_div

  • expo

  • mod

  • eval_exp

  • avg

py_everything.requestsLib:
  • getR

  • postR

  • putR

  • deleteR

  • patchR

  • optionsR

  • headR

  • getContent

  • getText

  • getJson

  • getHeader

  • getSpecificHeader

py_evrything.web:
  • google_search

  • yt_search

  • github_search

  • so_search

  • amz_in_search

  • amz_com_search

  • pypi_search

  • rtdocs_search

  • open_new_tab

  • open_new_window

Classes:
py_everything.date_utils:
  • Date

py_everything.fileIO:
  • FileIOBase

py_everything.maths:
  • MathsBase

  • MathsAdvanced

py_everything.requestsLib:
  • ReqLibBase

  • ReqLibAdvanced

py_everything.web:
  • webSearchBase

  • webSearchAdvanced

Glossary

D

dependencies
Dependencies

Other projects a project is dependent for it to work.

dependents
Dependents

Other projects which are depending on this project to work.

directory
Directory

A folder.

py_everything

Import -

How to import the module?

>>> import py_everything as pye

Your First Program using this package

What’s the best way to write your first program than “Hello, World!”

Function name - hello_world()

No. of Parameters - 0

Parameters - No parameters

Usage -
>>> pye.hello_world()
Hello, World!

So, we wrote our first program. Let’s move on.

Clear pycache

Function name - clearPycache(path)

No. of Parameters - 1

Parameters - path

Usage -
>>> pye.clearPycache(path\to\pycache\folder)
True

Provide the pth to the folder where the “__pycache__” is located. For example - C:ProgrammingProjectsPython

Note - Do not provide __pycache__ in the path. That does not clear it. For example - C:ProgrammingProjectsPython__pycache__. This would return False.

Install modules with pip

Function name - install_modules(*args)

No. of Parameters - infinte

Parameters - *args

Usage -
>>> pye.install_modules("py_everything", "requests")
True

This function install the given modules using pip. If the command is successful it returns True else False.

py_everything.automation

Import -

How to import the module?

>>> import py_everything.automation as pyeAuto

Send a mail with Python

Function name - email_bot(send_addr, password, recv_addr, body, server, port, sub=’No Subject’)

No. of Parameters - 7

Parameters - send_addr, password, recv_addr, body, server, port, sub=’No Subject’

Usage -
>>> my_addr = "your.email@add.ress"
>>> my_pass = "your password"
>>> to_addr = "recv.er@add.ress"
>>> my_body = "Email body"
>>> my_server = "your.smtp.server"
>>> my_port = "123"
>>> my_sub = "My Subject"
>>> pye.email_bot(my_addr, my_pass, to_addr, my_body, my_server, my_port, my_sub)
True

This function sends a mail to the address passed in recv_addr. sub is a optional parameter. The mail is sent from the value of sent_addr. sent_addr and password are used to authenticate with the server. The port is also very important. body, and sub are the Body and Subject of the email, respectively.

Note - Speacial settings must be enabled for this function to work properly. For e.g. - In Gmail you need to enable Less secure app access.

Slice an email address

Function name - email_address_slicer(full_addr)

No. of Parameters - 1

Parameters - full_addr

Usage -
>>> full_addr = 'long.demo.address@long-domain.com'
>>> pye.email_address_slicer(full_addr)
['long.demo.address', 'long-domain.com']

This function is usefull to get the username and domain of a email address seperately. full_addr takes in the the full email address that is to sliced.

Roll the Dice!

Function name - roll_dice(dice1=True)

No. of Parameters - 1

Parameters - dice_1

Usage -
>>> pye.roll_dice(dice_1=True)
4
>>> pye.roll_dice(dice_1=False)
8
>>> pye.roll_dice(dice_1=True)
6
>>> pye.roll_dice(dice_1=False)
11

This function doesn’t need explanation but still. If dice_1 is True then the number will be within th range of 1 to 6 but if dice_1 is False the range is from 1 to 12. That is dice_1 signifies the no. of dice being rolled. If True, 1 dice, else 2 die. It is True by default.

Run a timer

Function name - timer(seconds, audio_file)

No. of Parameters - 2

Parameters - seconds, audio_file

Usage -
>>> pye.timer(10, 'path/to/audio/file.mp3')
<---After 10 seconds, it plays the audio_file--->

This function countsdown seconds untill it reaches 0 and then plays audio_file. Both parameters are required.

Start or run a app or executable.

Function name - start_app(drive, app_path, exe_name)

No. of Parameters - 3

Parameters - drive, app_path, exe_name

Usage -
>>> pye.start_app('C', 'path/to/exe_file/file_name.exe')
True

This function uses the 3 parameters to run any executable.

Note - In exe_path, the full path, including exe name and extension are to be provided, in drive, only the letter is to be provided, the colon(:) is to be ommited. For example - start_app(‘C’, ‘C:/Program Files/company/exe_name.exe’).

… toctree::
caption

Basic:

py_everything.date_utils

Import -

How to import the module?

>>> import py_everything.date_utils as pyeDate

Get Current Date

Function Name - get_date()

No. of Parameters - 0

Parameters - None

Usage -
>>> pyeDate.get_date()
2021-03-17

This function prints the current date.

Get Current Date and Time

Function Name - get_date_time()

No. of Parameters - 0

Parameters - None

Usage -
>>> pyeDate.get_date_time()
2021-03-07 18:08:19.018239

This function prints the current date and time.

Get Current Time

Function Name - get_time()

No. of Parameters - 0

Parameters - None

Usage -
>>> pyeDate.get_time()
18:09:13

This function prints the current time.

Get Date and Time in Custom Format

Function Name - get_custom_format(format)

No. of Parameters - 1

Parameters - format

Usage -
>>> pyeDate.get_custom_format('%H:%M:%S')
18:09:13

This function prints the current date or time in format.

py_everything.fileIO

Import -

How to import the module?

>>> import py_everything.fileIO as pyeFiles

Read Data from a File

Function Name - read_file(filename)

No. of Parameters - 1

Parameter - filename

Usage -
>>> pyeFiles.read_file('path/to/file')
Data of the file is returned.

This function reads the data of filename and returns it.

Write Data to a File

Function Name - write_file(filename, writeData=’’)

No. of Parameters - 2

Parameter - filename, writeData

Usage -
>>> pyeFiles.write_file('path/to/file', writeData="Data to be written to the file.")
True

This function reads the file given in filename, then clears all its content and then writes writeData to the file. If these steps are successful, it returns True.

Clear or Erase Contents of a File

Function Name - write_file(filename)

No. of Parameters - 1

Parameter - filename

Usage -
>>> pyeFiles.clear_file('path/to/file')
True

This function reads the file given in filename, then clears all its contents. If the steps are successful, it returns True.

Make a New directory or Folder

Function Name - mk_dir(dir_name, path)

No. of Parameters - 2

Parameter - dir_name, path

Usage -
>>> pyeFiles.mk_dir('folderName', 'path/to/folder')
True

This function makes a new directory named dir_name in path. If steps are successful, returns True.

Make a New File

Function Name - mk_file(file_name, path)

No. of Parameters - 2

Parameter - file_name, path

Usage -
>>> pyeFiles.mk_file('fileName.txt', 'path/to/file/location')
True

This function makes a new file named file_name in path. If steps are successful, returns True.

Delete an Empty directory

Function Name - del_dir(path, dir_name)

No. of Parameters - 2

Parameter - path, dir_name

Usage -
>>> pyeFiles.del_dir('folderName', 'path/to/folder')
True

This function deletes an existing empty directory named dir_name that is in path. If steps are successful, returns True. Raises error if directory is not empty or does not exist.

Delete a directory with Items(Recursive Deletion)

Function Name - del_dir_rec(path, dir_name)

No. of Parameters - 2

Parameter - path, dir_name

Usage -
>>> pyeFiles.del_dir_rec('folderName', 'path/to/folder')
True

This function deletes an existing directory named dir_name that is in path. It deletes it regardless, it is empty or has items. If steps are successful, returns True. Raises error if direectory does not exist.

Delete a File

Function Name - del_file(path, file_name)

No. of Parameters - 2

Parameter - path, file_name

Usage -
>>> pyeFiles.del_file('fileName.txt', 'path/to/file/location')
True

This function deletes an existing file named file_name that is in path. If steps are successful, returns True. Raises error if file does not exist.

py_everything.maths

Import -

How to import the module?

>>> import py_everything.maths as pyeMaths

Add

Function Name - add(num1, num2, *args)

No. of Parameters - infinite

Parameters - num1, num2, *args

Usage -

>>> pyeMaths.add(1, 4, 3, 7, 3, 10, 13, 24)
65

Subtract

Function Name - subtract(num1, num2, *args)

No. of Parameters - infinite

Parameters - num1, num2, *args

Usage -

>>> pyeMaths.subtract(16, 4, 3)
9

Multiply

Function Name - multiply(num1, *args)

No. of Parameters - infinite

Parameters - num1, *args

Usage -

>>> pyeMaths.multiply(2, 4, 3)
24

Divide

Function Name - divide(num1, num2, type)

No. of Parameters - 3

Parameters - num1, num2, type

Usage -

>>> pyeMaths.divide(36, 3, 'float')
12.0
>>> pyeMaths.divide(36, 3, 'int')
12

Float Division

Function Name - float_div(num1, num2)

No. of Parameters - 2

Parameters - num1, num2

Usage -

>>> pyeMaths.float_div(36, 3)
12.0

Integer Division

Function Name - int_div(num1, num2)

No. of Parameters - 2

Parameters - num1, num2

Usage -

>>> pyeMaths.int_div(36, 3)
12

Exponent

Function Name - expo(num1, num2)

No. of Parameters - 2

Parameters - num1, num2

Usage -

>>> pyeMaths.expo(2, 4)
16

Modulus

Function Name - mod(num1, num2)

No. of Parameters - 2

Parameters - num1, num2

Usage -

>>> pyeMaths.mod(17, 2)
1

Evaluate Any Mathematics Expression

Function Name - eval_exp(exp)

No. of Parameters - 1

Parameters - exp

Usage -

>>> pyeMaths.expo('2 + 4 - 1 * 2')
10

Average

Function Name - avg(listOfNos)

No. of Parameters - 1

Parameters - listOfNos

Usage -

>>> pyeMaths.avg(['2', '3', '1', '5', '8', '4', '3'])
3.7142857142857144

Note

These functions have not been explained seperately because they explain themselves.

py_everything.requestsLib

Import -

How to import the module?

>>> import py_everything.requestsLib as pyeRLib

Send a GET Request

Function Name - getR(apiUrl)

No. of Parameters - 1

Parameters - apiUrl

Usage -
>>> pyeRLib.getR("protocol://api.domain.com/user/1")
<Response [200]>

This function uses requests to send a get request to apiUrl.

Send a POST Request

Function Name - postR(apiUrl, data=None)

No. of Parameters - 2

Parameters - apiUrl, data

Usage -
>>> pyeRLib.postR("protocol://api.domain.com/users", "{\"id\":1}")
<Response [200]>

This function uses requests to send a post request to apiUrl.

Send a PUT Request

Function Name - putR(apiUrl, data=None)

No. of Parameters - 2

Parameters - apiUrl, data

Usage -
>>> pyeRLib.putR("protocol://api.domain.com/users", data="{\"id\":1")
<Response [200]>

This function uses requests to send a put request to apiUrl.

Send a DELETE Request

Function Name - deleteR(apiUrl)

No. of Parameters - 1

Parameters - apiUrl

Usage -
>>> pyeRLib.deleteR("protocol://api.domain.com/user/1")
<Response [200]>

This function uses requests to send a delete request to apiUrl.

Send a PATCH Request

Function Name - patchR(apiUrl, data=None)

No. of Parameters - 2

Parameters - apiUrl, data

Usage -
>>> pyeRLib.patchR("protocol://api.domain.com/users", data="\"id\":1")
<Response [200]>

This function uses requests to send a patch request to apiUrl.

Send a OPTIONS Request

Function Name - optionsR(apiUrl)

No. of Parameters - 1

Parameters - apiUrl

Usage -
>>> pyeRLib.optionsR("protocol://api.domain.com/users")
<Response [200]>

This function uses requests to send a options request to apiUrl.

Send a HEAD Request

Function Name - headR(apiUrl)

No. of Parameters - 1

Parameters - apiUrl

Usage -
>>> pyeRLib.headR("protocol://api.domain.com/users")
<Response [200]>

This function uses requests to send a head request to apiUrl.

Get Content from a Response

Function Name - getContent(response)

No. of Parameters - 1

Parameters - response

Usage -
>>> pyeRLib.getContent(pyeRLib.getR("protocol://api.domain.com/user/1"))
<--Content of the reponse-->

This function uses requests to get the content of response.

Get Text from a Response

Function Name - getText(response)

No. of Parameters - 1

Parameters - response

Usage -
>>> pyeRLib.getText(pyeRLib.getR("protocol://api.domain.com/user/1"))
<--Text of the reponse-->

This function uses requests to get the text returned to response.

Get JSON from a Response

Function Name - getJson(response)

No. of Parameters - 1

Parameters - response

Usage -
>>> pyeRLib.getJson(pyeRLib.getR("protocol://api.domain.com/user/1"))
<--JSON of the reponse-->

This function uses requests to get the JSON returned to response.

Get Headers from a Response

Function Name - getHeader(response)

No. of Parameters - 1

Parameters - response

Usage -
>>> pyeRLib.getHeader(pyeRLib.getR("protocol://api.domain.com/user/1"))
<--Headers of the reponse-->

This function uses requests to get the Headers returned to response.

Get a Specific Header from a Response

Function Name - getSpecificHeader(response, headerName)

No. of Parameters - 2

Parameters - response, headerName

Usage -
>>> pyeRLib.getSpecificHeader(pyeRLib.getR("protocol://api.domain.com/user/1"))
<--Content of headerName of the reponse-->

This function uses requests to get the content of headerName returned to response.

py_everything.web

Import -

How to import the module?

>>> import py_everything.web as pyeWeb

Search Google

Function Name - google_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.google_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches Google for query.

Search Youtube

Function Name - yt_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.yt_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches YouTube for query.

Search GitHub

Function Name - github_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.github_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches GitHub for query.

Search Stack Overflow

Function Name - so_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.so_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches Stack Overflow for query.

Search Amazon.in

Function Name - amz_in_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.amz_in_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches Amazon.in for query.

Search Amazon.com

Function Name - amz_com_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.amz_com_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches Amazon.com for query.

Search PyPI

Function Name - pypi_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.pypi_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches PyPI for query.

Search Read The Docs

Function Name - rtdocs_search(query)

No. of Parameters - 1

Parameters - query

Usage -
>>> pyeWeb.rtdocs_search("py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches Read the Docs for query.

Search in a New Tab

Function Name - open_new_tab(url, query)

No. of Parameters - 2

Parameters - url, query

Usage -
>>> google_url = 'https://google.com/search?q='
>>> pyeWeb.open_new_tab(google_url, "py_everything")
<--It opens a tab in your browser and shows the results-->

This function searches Google for query in a new tab.

Search in a New Window

Function Name - open_new_window(url, query)

No. of Parameters - 2

Parameters - url, query

Usage -
>>> gh_url = 'https://github.com/search?q='
>>> pyeWeb.open_new_window(gh_url, "py_everything")
<--It opens a window in your browser and shows the results-->

This function searches GitHub for query in a new window.

… toctree::
caption

Basic:

License

MIT License

Copyright (c) 2021 py_everything

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Need Help?

Need help with anything? Join the GitHub Discussions.