Skip to content

An account management system coded in Python that uses MongoDB as It's database.

License

Notifications You must be signed in to change notification settings

aarongsellin/pyAMS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 

Repository files navigation

pyAMS

pyAMS stands for Account management system and is a userfriendly library for adding a very simple and easy to use login system to any application. It uses MongoDB as It's database.

Installing

Download with git.

$ git clone https://github.com/mrikea4real/pyAMS

In the future you will be able to install pyAMS with pip.

Examples

Login Ex:

>>> from pyAccountManagementSystem import *
>>> manager = ManagerSetup("mongodb://mongodb0.example.com:27017")
>>> manager.login("username","password")
1

Create Ex:

>>> from pyAccountManagementSystem import *
>>> manager = ManagerSetup("mongodb://mongodb0.example.com:27017")
>>> manager.create("username","password")
1

Client Login Ex:

>>> import socket
>>> 
>>> loginStr = {"login":{"username":"tester","password":"password"}}
>>> s = socket.socket()
>>> 
>>> s.connect((10.10.10.10,8500))
>>> s.send(bytes(loginStr,encoding="ASCII"))
>>> print(str(s.recv(1024),encoding="ASCII"))
Logged in.
>>> s.close()

Client Create Ex:

>>> import socket
>>> 
>>> createStr = {"create":{"username":"tester","password":"password","data":{"name":"John Doe"}}}
>>> s = socket.socket()
>>> 
>>> s.connect((10.10.10.10,8500))
>>> s.send(bytes(createStr,encoding="ASCII"))
>>> print(str(s.recv(1024),encoding="ASCII"))
Account created.
>>> s.close()

Documentation

The entire system is centered around the manager object.

ManagerSetup(Connection string) - Returns the account manager, needs the mongodb connection string.

ManagerClass.login(username,password) - Login to an account with username and password.

ManagerClass.create(username,password,data={}) - Create an account with username and password, optionally passing along a data json string.

ManagerClass.get(username) - Returns account data in json string format.

ManagerClass.set(username,data) - Replace account data with other data.

ManagerClass.listen(port) - Listen on a and handle client logins. (This should not be used in live projects, only for testing)

Contributing

I would be more than happy to accpet contributions. These can come in the form of bug reports, feature requests and pure code!

Maintainers

  • @mrikea4real (Aaron Gotthardsson)

About

An account management system coded in Python that uses MongoDB as It's database.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published