Skip to content

iamjiamingliu/PickleServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PickleServer

A package that offers Client-Server operations for Pickling any python data

  • Uses Flask for running server, Pickle for pickling data
  • 100 % Python
  • Super Reliable

Download the Package

The module will be uploaded to Pip. At the moment, you can still enjoy it by directing downloading the folder on github and play around with it :)

Features

  • class "PickleServer" for running pickle server
  • class "PickleClient" for connecting to the pickle server, loading and dumping data
  • error handling & preventing data loss when failed to dump a pickle object

Example usages

Importing the Module:

from pickleserver import PickleServer, PickleClient

Running the Pickle Server:

p_server = PickleServer(SECRET_KEY="blahblahblah", debug=False, port=12138, host="127.0.0.1")
# There are other optional kwargs, of course. Feel free to play around with them!
p.run()

Creating the Pickle Client:

p_client = PickleClient("http://127.0.0.1:12138", SECRET_KEY="blahblahblah")
# The first and only argument is the server url (full url), whereas the SECRET_KEY must match the secret key of the PickleServer you are trying to connect

Dumping and Loading some Data:

data = p_client.load('test.db')
print("here is the loaded data:")
print(data)
data2 = {'test2': 'hello there'}
response = p_client.dump(data2, 'test2.db')
print("here is the message after you have dumped an object:")
print(response)

# This what the result of the above code looks like, if you have the pickle server running and client connected properly:
here is the loaded data:
{'test': 'hi'}
here is the message after you have dumped an object:
{'note': 'Dump operation successful', 'status': True}

Conclusion

That's it! That's what PickleServer can do for you! It's extremely simple to use, yet powerful! Have fun and hope this helps!

@ PickleServer 2021, MIT Licensed

About

A package that offers Client-Server operations for Pickling any python data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages