Skip to content
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
1 change: 0 additions & 1 deletion __init__.py

This file was deleted.

1 change: 1 addition & 0 deletions freeipa_api_client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .lib import IPAAuth, IPAClient, IPAPassword
5 changes: 5 additions & 0 deletions freeipa_api_client/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .ipaAuth import IPAAuth
from .ipaClient import IPAClient
from .ipaPassword import IPAPassword
from .ipaResponse import IPAResponse

11 changes: 7 additions & 4 deletions lib/ipaAuth.py → freeipa_api_client/lib/ipaAuth.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import urllib
from Cookie import SimpleCookie
from ipaResponse import IPAResponse
try:
from urllib.parse import urlencode
except ImportError: # fallback to Python 2.x
from urllib import urlencode
from http.cookies import SimpleCookie
from .ipaResponse import IPAResponse


class IPAAuth(object):
Expand Down Expand Up @@ -36,7 +39,7 @@ def __urlEncodeUserData__(self, userData):
if self.KEY_USER not in userData or self.KEY_PASSWORD not in userData:
raise ValueError('Missing user/password key')

return urllib.urlencode(userData)
return urlencode(userData)

def authenticate(self, username, password):
"""
Expand Down
4 changes: 2 additions & 2 deletions lib/ipaClient.py → freeipa_api_client/lib/ipaClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import requests
import datetime
import pytz
from ipaAuth import IPAAuth
from ipaResponse import IPAResponse
from .ipaAuth import IPAAuth
from .ipaResponse import IPAResponse
from dateutil.parser import parse


Expand Down
9 changes: 6 additions & 3 deletions lib/ipaPassword.py → freeipa_api_client/lib/ipaPassword.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import urllib
try:
from urllib.parse import urlencode
except ImportError: # fallback to Python 2.x
from urllib import urlencode


class IPAPassword(object):
Expand Down Expand Up @@ -39,7 +42,7 @@ def __urlEncodeUserData__(self, userData):
userData:
raise ValueError(self.MSG_MISSING_KEYS)

return urllib.urlencode(userData)
return urlencode(userData)

def changePassword(self, username, oldPassword, newPassword):
userData = {
Expand All @@ -55,4 +58,4 @@ def changePassword(self, username, oldPassword, newPassword):

responseHeaders = response.headers

return responseHeaders['x-ipa-pwchange-result'] == 'ok'
return responseHeaders['x-ipa-pwchange-result'] == 'ok', response
File renamed without changes.
5 changes: 0 additions & 5 deletions lib/__init__.py

This file was deleted.

14 changes: 0 additions & 14 deletions requirements.py

This file was deleted.

3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
requests
pytz
python-dateutil
81 changes: 81 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""

from setuptools import setup, find_packages
import os

package_root = os.path.abspath(os.path.dirname(__file__))

setup(
name='freeipa_api_client',

version='1.0.0',

description="Library for interacting with FreeIPA JSON api",
long_description="Learn more at https://github.com/sangm/freeipa_api_client",

# The project's main homepage.
url='https://github.com/sangm/freeipa_api_client',

# Author details
author='Sang Mercado',
author_email='sang.mercado@gmail.com',

# Choose your license
license='MIT',

# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',

# Indicate who your project is intended for
'Intended Audience :: Developers',

# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: MIT License',

# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
],

# What does your project relate to?
keywords='freeipa API JSON library',

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
packages=find_packages(exclude=['contrib', 'docs', 'tests']),

# Alternatively, if you want to distribute just a my_module.py, uncomment
# this:
# py_modules=["my_module"],

# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=open(os.path.join(package_root, 'requirements.txt')).read().split('\n'),

# List additional groups of dependencies here (e.g. development
# dependencies). You can install these using the following syntax,
# for example:
# $ pip install -e .[dev,test]
extras_require={
#'dev': ['check-manifes'],
#'test': ['coverage'],
},

)