cleanup + more args
This commit is contained in:
34
README.md
34
README.md
@@ -1,17 +1,34 @@
|
|||||||
|
<h1 align="center">
|
||||||
|
Pip Install Bitches 😩
|
||||||
|
</h1>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://img.shields.io/pypi/v/bitches?style=flat-square" </a>
|
<kbd>
|
||||||
<img src="https://img.shields.io/pypi/l/bitches?style=flat-square" </a>
|
<img src="https://raw.githubusercontent.com/Rdimo/images/master/pip-install-bitches/Roxy-pip-install-bitches.jpg"></img>
|
||||||
<img src="https://img.shields.io/pypi/dm/bitches?style=flat-square" </a>
|
</kbd>
|
||||||
<img src="https://img.shields.io/github/stars/Rdimo/pip-install-bitches?label=Stars&style=flat-square" </a>
|
|
||||||
<img src="https://img.shields.io/github/forks/Rdimo/pip-install-bitches?label=Forks&style=flat-square" </a>
|
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
#### pip-install-bitches was made by
|
<p align="center">
|
||||||
|
<img src="https://img.shields.io/pypi/v/bitches?style=flat-square">
|
||||||
|
<img src="https://img.shields.io/pypi/dm/bitches?style=flat-square">
|
||||||
|
<img src="https://sonarcloud.io/api/project_badges/measure?project=Rdimo_pip-install-bitches&metric=ncloc">
|
||||||
|
<img src="https://img.shields.io/github/stars/Rdimo/pip-install-bitches?label=Stars&style=flat-square">
|
||||||
|
<img src="https://img.shields.io/github/forks/Rdimo/pip-install-bitches?label=Forks&style=flat-square">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h2 align="center">
|
||||||
|
pip-install-bitches was made by
|
||||||
|
|
||||||
Love ❌ code ✅
|
Love ❌ code ✅
|
||||||
|
|
||||||
|
</h2>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 🎈・Code example
|
### 🎈・Code example
|
||||||
|
|
||||||
Example of how you can use [bitches](https://pypi.org/project/bitches/)
|
Example of how you can use [bitches](https://pypi.org/project/bitches/)
|
||||||
|
|
||||||
```py
|
```py
|
||||||
import bitches #valid
|
import bitches #valid
|
||||||
|
|
||||||
@@ -19,5 +36,8 @@ bitches.get()
|
|||||||
|
|
||||||
or
|
or
|
||||||
|
|
||||||
bitches.get("yes") #yes is the name of the directory that will be created
|
bitches.get(
|
||||||
|
"yes", # directory name (default: "bitches")
|
||||||
|
5 # amount of bitches (default: randint(5, 10))
|
||||||
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -1,49 +1,31 @@
|
|||||||
# how about you import some bitches
|
# how about you import some bitches
|
||||||
import os
|
|
||||||
import requests
|
import requests
|
||||||
|
from os import mkdir, sep
|
||||||
from random import randint
|
from random import randint
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
|
||||||
|
|
||||||
api = 'https://api.waifu.pics/nsfw/waifu'
|
api = 'https://api.waifu.pics/nsfw/waifu'
|
||||||
|
|
||||||
def get(dirr=None):
|
|
||||||
'''can choose directory name too'''
|
|
||||||
directory = "bitches"
|
|
||||||
if dirr:
|
|
||||||
directory = dirr
|
|
||||||
try: os.mkdir(directory)
|
|
||||||
except Exception: pass
|
|
||||||
for i in range(randint(5, 10)):
|
|
||||||
Thread(target=bitches, args=(directory, )).start()
|
|
||||||
|
|
||||||
def bitches(dir_):
|
def get(directory="bitches", amount=randint(5, 10)):
|
||||||
for i in range(randint(3, 7)):
|
'''can choose directory name too'''
|
||||||
|
try:
|
||||||
|
mkdir(directory)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
for i in range(amount):
|
||||||
|
Thread(target=bitches, args=(directory, amount)).start()
|
||||||
|
|
||||||
|
|
||||||
|
def bitches(dir_, amount=randint(3, 7)):
|
||||||
|
for i in range(amount):
|
||||||
req_url = requests.get(api)
|
req_url = requests.get(api)
|
||||||
url = req_url.json()['url']
|
url = req_url.json()['url']
|
||||||
if not req_url.ok:
|
if not req_url.ok:
|
||||||
print("error: "+req_url)
|
print("error: "+req_url)
|
||||||
with open(dir_+os.sep+url[21:], 'wb') as f:
|
with open(dir_+sep+url[21:], 'wb') as f:
|
||||||
response = requests.get(url, stream=True)
|
response = requests.get(url, stream=True)
|
||||||
for block in response.iter_content(1024):
|
for block in response.iter_content(1024):
|
||||||
if not block:
|
if not block:
|
||||||
break
|
break
|
||||||
f.write(block)
|
f.write(block)
|
||||||
|
|
||||||
def tempDir():
|
|
||||||
system = os.name
|
|
||||||
if system == 'nt':
|
|
||||||
return os.getenv('temp')
|
|
||||||
elif system == 'posix':
|
|
||||||
return '/tmp/'
|
|
||||||
|
|
||||||
def zipfile(_file):
|
|
||||||
_zipfile = os.path.join(os.getcwd(), 'bitches.zip')
|
|
||||||
zipped_file = ZipFile(_zipfile, "w", ZIP_DEFLATED)
|
|
||||||
abs_src = os.path.abspath(_file)
|
|
||||||
for dirname, _, files in os.walk(_file):
|
|
||||||
for filename in files:
|
|
||||||
absname = os.path.abspath(os.path.join(dirname, filename))
|
|
||||||
arcname = absname[len(abs_src) + 1:]
|
|
||||||
zipped_file.write(absname, arcname)
|
|
||||||
zipped_file.close()
|
|
||||||
Reference in New Issue
Block a user