Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update from original #1

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

Merged
merged 12 commits into from
Oct 9, 2018
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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Real Python

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.
5 changes: 5 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
1. Write unit and integration tests for *all* scripts
1. Add Travis
1. Add support for Python 2.7, 3.5, and 3.6
1. Organize docs and folder structure better
1. Add all scripts to single CLI for easy running, testing, and searching
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
1. **30_fullcontact.py**: Call the [FullcContact](https://www.fullcontact.com/developer/) API
1. **31_youtube_sentiment.py**: Calculate sentiment score from the comments of a Youtube video
1. **32_stock_scraper.py**: Get stock prices
1. **33_country_code.py**: Convert country code to country name
1. **34_git_all_repos.py**: Clone all repositories from a public user or organization on Github. Usage: `python git_all_repos.py users USER_NAME` or `python git_all_repos.py orgs ORG_NAME`
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
beautifulsoup4==4.4.1
PyYAML==3.11
requests==2.7.0
requests==2.12.4
wheel==0.24.0
lxml==3.8.0
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# constants
PATH = './'
PATTERN = '*.py'
PATTERN = '*.md'


def get_file_names(filepath, pattern):
Expand All @@ -28,4 +28,4 @@ def output_files(list_of_files):


if __name__ == '__main__':
all_files = get_file_names(PATH, PATTERN)
get_file_names(PATH, PATTERN)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from random import randint
from random import choice


def random_name_generator(first, second, x):
Expand All @@ -10,13 +10,8 @@ def random_name_generator(first, second, x):
- number of random names
"""
names = []
for i in range(0, int(x)):
random_first = randint(0, len(first)-1)
random_last = randint(0, len(second)-1)
names.append("{0} {1}".format(
first[random_first],
second[random_last])
)
for i in range(x):
names.append("{0} {1}".format(choice(first), choice(second)))
return set(names)


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions scripts/34_git_all_repos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import sys
import os
import requests


def get_total_repos(group, name):
repo_urls = []
page = 1
while True:
url = 'https://api.github.com/{0}/{1}/repos?per_page=100&page={2}'
r = requests.get(url.format(group, name, page))
if r.status_code == 200:
rdata = r.json()
for repo in rdata:
repo_urls.append(repo['clone_url'])
if (len(rdata) >= 100):
page += 1
else:
print('Found {0} repos.'.format(len(repo_urls)))
break
else:
print(r)
return False
return repo_urls


def clone_repos(all_repos):
count = 1
print('Cloning...')
for repo in all_repos:
os.system('Git clone ' + repo)
print('Completed repo #{0} of {1}'.format(count, len(all_repos)))
count += 1

if __name__ == '__main__':
if len(sys.argv) > 2:
total = get_total_repos(sys.argv[1], sys.argv[2])
if total:
clone_repos(total)

else:
print('Usage: python USERS_OR_ORG GITHUB_USER_OR_ORG-NAME')
File renamed without changes.