Skip to content

Commit 667a316

Browse files
author
James Campbell
committed
updates
1 parent b1be0e8 commit 667a316

16 files changed

+223
-175
lines changed

Pipfile

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ tabulate = "*"
3434
tqdm = "*"
3535
redis = "*"
3636
psycopg2-binary = "*"
37+
autopep8 = "*"
3738

3839
[requires]
3940
python_version = "3.7"
41+
42+
[pipenv]
43+
allow_prereleases = true

Pipfile.lock

+33-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyzillow-example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"""Example using pyzillow."""
2-
"""You need a zillow api key: https://www.zillow.com/howto/api/APIOverview.htm"""
32
from pyzillow.pyzillow import ZillowWrapper, GetDeepSearchResults, GetUpdatedPropertyDetails
43
import argparse
54
from pprint import pprint
5+
"""You need a zillow api key: https://www.zillow.com/howto/api/APIOverview.htm"""
66
# arguments
77
parser = argparse.ArgumentParser(description='zillow data example')
88
parser.add_argument('-a', '--address', dest='address', help='address to search',

quandl-example.py

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
1-
#!/usr/bin/python
2-
31
# Author: James Campbell
42
# Date Created: May 21st 2016
5-
# Date Updated:
3+
# Date Updated: 2 July 2019
64
# What: Example to get stock prices
75
from sys import exit
86
try:
97
import quandl
10-
except:
8+
except Exception:
119
exit('quandl module required, run pip or pip3 install quandl --update')
1210
try:
1311
from configs import myqkey
14-
except:
12+
except Exception:
1513
print('no configs file set, create a file called configs.py and add var to it like myqkey = "whatever"')
1614
myqkey = 'yoursecretkeyfromquandl.com'
1715
# set API key
18-
quandl.ApiConfig.api_key = myqkey # get free key at quandl.com
19-
#data = quandl.get("WIKI/AAPL") # data passed into panda data table
20-
# optional parameters can also be passed:
21-
dataset_data = quandl.Dataset('WIKI/AAPL').data(params={ 'start_date':'2001-01-01', 'end_date':'2010-01-01', 'collapse':'annual', 'transformation':'rdiff', 'rows':4 })
16+
quandl.ApiConfig.api_key = myqkey # get free key at quandl.com
17+
18+
dataset_data = quandl.Dataset('WIKI/AAPL').data(params={'start_date': '2001-01-01',
19+
'end_date': '2010-01-01', 'collapse': 'annual', 'transformation': 'rdiff', 'rows': 4})
2220
print('first date: {}'.format(dataset_data[0].date))
2321
print('Total days of stock data available: {}'.format(len(dataset_data)))
2422
print('The data includes the following columns: {}'.format(dataset_data.column_names))

read-spreadsheet-example.py

+15-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
# read values from a spreadsheet
22

3-
import sys, os, subprocess, fnmatch
3+
import sys
4+
import os
5+
import subprocess
6+
import fnmatch
47
import xlrd
58

9+
610
def find_files(directory, pattern):
711
for root, dirs, files in os.walk(directory):
812
for basename in files:
913
if fnmatch.fnmatch(basename, pattern):
1014
filename = basename
1115
yield filename
1216

13-
filename='test.xls'
17+
18+
filename = 'test.xls'
1419
header = 1
1520
outputfilename = ''
1621
pathoffile = ''
@@ -20,14 +25,14 @@ def find_files(directory, pattern):
2025
num_rows = worksheet.nrows - 1
2126
num_cells = worksheet.ncols - 1
2227
if header == 1:
23-
curr_row = 0
28+
curr_row = 0
2429
else:
25-
curr_row = -1
30+
curr_row = -1
2631
curr_cell = -1
2732
while curr_row < num_rows:
28-
curr_row += 1
29-
row = worksheet.row(curr_row)
30-
print 'Row:', curr_row
31-
outputfilename = worksheet.cell_value(curr_row, 0)
32-
pathoffile = worksheet.cell_value(curr_row, 1)
33-
print ('Filename: %s\nPath: %s' % (outputfilename, pathoffile))
33+
curr_row += 1
34+
row = worksheet.row(curr_row)
35+
print 'Row:', curr_row
36+
outputfilename = worksheet.cell_value(curr_row, 0)
37+
pathoffile = worksheet.cell_value(curr_row, 1)
38+
print('Filename: %s\nPath: %s' % (outputfilename, pathoffile))

read_wav_display_audio-example.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,13 @@
88
# read audio samples
99
input_data = read("/Users.wav")
1010
audio = input_data[1]
11-
# plot the first 1024 samples
12-
#plt.plot(audio[0:1024])
13-
#plot the entire audio track
11+
1412
plt.plot(audio)
1513

1614
# label the axes
1715
plt.ylabel("Amplitude")
1816
plt.xlabel("Time")
19-
# set the title
17+
# set the title
2018
plt.title("Sample Wav")
2119
# display the plot
22-
plt.show()
20+
plt.show()

request_post_go_with_hug_post-example.py

-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@
44
foreigntext = 'станция'
55
url = 'http://127.0.0.1:8000/test'
66
sendtext = {'hello': foreigntext}
7-
#sendtext = {'hello':'world'}
87
print(sendtext)
98
r = requests.post(url, json=sendtext)

requests-example.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
import requests
44
from bs4 import BeautifulSoup
55

6+
67
def get_rss_feed(website_url):
8+
"""Get RSS feed."""
79
if website_url is None:
810
print("URL should not be null")
911
else:
1012
source_code = requests.get(website_url)
1113
plain_text = source_code.text
1214
soup = BeautifulSoup(plain_text, "lxml")
13-
for link in soup.find_all("link", {"type" : "application/rss+xml"}):
15+
for link in soup.find_all("link", {"type": "application/rss+xml"}):
1416
href = link.get('href')
1517
print("RSS feed for " + website_url + "is --> " + str(href))
1618

19+
1720
get_rss_feed("https://0x41.no/")

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ geotext
2222
tabulate
2323
tdqm
2424
redis
25-
psycopg2-binary
25+
psycopg2-binary
26+
tika

0 commit comments

Comments
 (0)