Skip to content
This repository has been archived by the owner on Feb 1, 2022. It is now read-only.

Fixed some documentation and fixed support for Python3 #7

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@
#virtualenv
env
sandbox
.venv/
pywqp.egg-info
.idea/
1 change: 0 additions & 1 deletion .idea/.name

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/encodings.xml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/misc.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/modules.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/pywqp.iml

This file was deleted.

5 changes: 0 additions & 5 deletions .idea/scopes/scope_settings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/vcs.xml

This file was deleted.

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Alternatively, you can download the package and add it manually to your path.
### Using <tt>pywqp_client.py</tt> in your Python program
The core resource of `pywqp_client` is the class `RESTClient`. Instantiation is fairly simple:
<pre>
<tt>import pywpq_client
client_instance = pywqp_client.RESTClient()</tt>
from pywqp import pywqp_client
client_instance = pywqp_client.RESTClient()
</pre>

`client_instance` is now ready to run any of the functions exposed by `RESTClient`. Examples of the important ones are shown below. In all cases, the example name "client_instance" is reused for simplicity, but that name has no particular significance. Name your objects as you wish.
Expand Down Expand Up @@ -85,11 +85,11 @@ This function makes a call to the Water Quality Portal server specified in the `
<br/>
##### Example: downloading CSV data for Stations in Boone County, Iowa, US that have made pH observations.
<pre>
<tt>verb = 'get'
verb = 'get'
host_url = 'http://waterqualitydata.us'
resource_label = 'station'
params = {'countrycode': 'US', 'statecode': 'US:19', 'countycode': 'US:19:015', 'characteristicName': 'pH'}
result = client_instance.request_wqp_data(verb, host_url, resource_label, params, mime_type='text/csv')</tt>
result = client_instance.request_wqp_data(verb, host_url, resource_label, params, mime_type='text/csv')
</pre>

<br/>
Expand Down
12 changes: 12 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from pywqp import pywqp_client
client_instance = pywqp_client.RESTClient()
from pprint import pprint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer keeping import statements before any other statements in a python module.



verb = 'get'
host_url = 'http://waterqualitydata.us'
resource_label = 'station'
params = {'countrycode': 'US', 'statecode': 'US:19', 'countycode': 'US:19:015', 'characteristicName': 'pH'}
result = client_instance.request_wqp_data(verb, host_url, resource_label, params, mime_type='text/csv')

pprint(result.text)
4 changes: 2 additions & 2 deletions pywqp/pywqp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import sys
import os.path
import pandas as pd
import StringIO
import wqx_mappings
from io import StringIO
from . import wqx_mappings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this import is for a local package, it should go after the others. In general, our import lists don't at the moment but should follow https://www.python.org/dev/peps/pep-0008/#imports .

import xml.etree.ElementTree as et


Expand Down
10 changes: 5 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fuzzywuzzy==0.2
lettuce==0.2.19
numpy==1.8.1
pandas==0.14.1
python-dateutil==2.2
pytz==2014.4
lxml==4.4.1
numpy==1.17.0
pandas==0.25.0
python-dateutil==2.8.0
pytz==2019.2
requests==2.3.0
six==1.7.3
sure==1.2.7
wsgiref==0.1.2
24 changes: 13 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
import sys
from setuptools import find_packages, setup

try:
from setuptools import setup
except:
sys.exit('Requires distribute or setuptools')

from setuptools import find_packages
def requires():
deps = []
with open('requirements.txt', 'r') as fil:
for line in fil.readlines():
deps.append(line.rstrip())
return deps


setup(
name = 'pywqp',
version = '0.1.4-dev',
description = 'Interface to the Water Quality Portal',
long_description = open('README.md').read(),
name='pywqp',
version='0.1.5',
description='Interface to the Water Quality Portal',
long_description=open('README.md').read(),
license='Public Domain',
maintainer='William Blondeau',
maintainer_email='[email protected]',
py_modules=['pywqp'],
packages=find_packages(),
install_requires=['setuptools'],
install_requires=requires(),
url='https://github.com/wblondeau-usgs/pywqp',
test_suite='tests',
)