diff --git a/History.md b/History.md new file mode 100644 index 0000000..d73eee0 --- /dev/null +++ b/History.md @@ -0,0 +1,5 @@ + +n.n.n / 2013-07-07 +================== + + * added gitignore, readme and setup.py diff --git a/dist/json2xml-0.1-py2.7.egg b/dist/json2xml-0.1-py2.7.egg new file mode 100644 index 0000000..62b7ee9 Binary files /dev/null and b/dist/json2xml-0.1-py2.7.egg differ diff --git a/docs/docs.md b/docs/docs.md new file mode 100644 index 0000000..c6a5a7a --- /dev/null +++ b/docs/docs.md @@ -0,0 +1,5 @@ +#Docs + +Docs will be updated as this module goes further development.The current form +is pretty self explanatory. + diff --git a/examples/example.py b/examples/example.py new file mode 100644 index 0000000..6acf933 --- /dev/null +++ b/examples/example.py @@ -0,0 +1,35 @@ +#! /usr/bin/env python + +BASE_URL = 'http://maps.googleapis.com/maps/api/geocode/json' + +import sys +import os +import urllib + + +sys.path.insert(0, os.path.abspath('..')) + +from json2xml import json2xml + + +def geocode(address, sensor, **geo_args): + geo_args.update({ + 'address': address, + 'sensor': sensor + }) + + +def main(): + geocode(address="pune", sensor="false") + geo_args = {'sensor': 'false', 'address': 'pune'} + url = BASE_URL + '?' + urllib.urlencode(geo_args) + data = json2xml.Json2xml(url) + print data.json2xml() + + +if __name__ == "__main__": + main() + + + + diff --git a/json2xml.egg-info/PKG-INFO b/json2xml.egg-info/PKG-INFO new file mode 100644 index 0000000..916e963 --- /dev/null +++ b/json2xml.egg-info/PKG-INFO @@ -0,0 +1,29 @@ +Metadata-Version: 1.1 +Name: json2xml +Version: 0.1 +Summary: Python Command-line Application Tools +Home-page: https://github.com/vinitcool76/json2xml +Author: Vinit Kumar +Author-email: vinit.kumar@changer.nl +License: MIT +Description: + + + n.n.n / 2013-07-07 + ================== + + * added gitignore, readme and setup.py + +Platform: UNKNOWN +Classifier: Environment :: Console +Classifier: Intended Audience :: Developers +Classifier: Natural Language :: English +Classifier: License :: OSI Approved :: ISC License (ISCL) +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2.7 +Classifier: Programming Language :: Python :: 3 +Classifier: Programming Language :: Python :: 3.1 +Classifier: Programming Language :: Python :: 3.2 +Classifier: Topic :: Terminals :: Terminal Emulators/X Terminals diff --git a/json2xml.egg-info/SOURCES.txt b/json2xml.egg-info/SOURCES.txt new file mode 100644 index 0000000..ce70ebb --- /dev/null +++ b/json2xml.egg-info/SOURCES.txt @@ -0,0 +1,6 @@ +setup.py +json2xml.egg-info/PKG-INFO +json2xml.egg-info/SOURCES.txt +json2xml.egg-info/dependency_links.txt +json2xml.egg-info/requires.txt +json2xml.egg-info/top_level.txt \ No newline at end of file diff --git a/json2xml.egg-info/dependency_links.txt b/json2xml.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/json2xml.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/json2xml.egg-info/requires.txt b/json2xml.egg-info/requires.txt new file mode 100644 index 0000000..6350aff --- /dev/null +++ b/json2xml.egg-info/requires.txt @@ -0,0 +1 @@ +dict2xml \ No newline at end of file diff --git a/json2xml.egg-info/top_level.txt b/json2xml.egg-info/top_level.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/json2xml.egg-info/top_level.txt @@ -0,0 +1 @@ + diff --git a/json2xml/__init__.py b/json2xml/__init__.py new file mode 100644 index 0000000..1c6be3a --- /dev/null +++ b/json2xml/__init__.py @@ -0,0 +1 @@ +__version__ = 0.1 diff --git a/json2xml/__init__.pyc b/json2xml/__init__.pyc new file mode 100644 index 0000000..86a6872 Binary files /dev/null and b/json2xml/__init__.pyc differ diff --git a/json2xml/json2xml.py b/json2xml/json2xml.py new file mode 100644 index 0000000..fc9f721 --- /dev/null +++ b/json2xml/json2xml.py @@ -0,0 +1,18 @@ +#! /usr/bin/env python + +import simplejson, urllib, dict2xml +from BeautifulSoup import BeautifulStoneSoup + +class Json2xml(object): + + def __init__(self, url): + self.url = url + + def json2xml(self): + data = simplejson.load(urllib.urlopen(self.url)) + if data: + xmldata = dict2xml.dict2xml(data) + xml = BeautifulStoneSoup(xmldata) + return xml + + diff --git a/json2xml/json2xml.pyc b/json2xml/json2xml.pyc new file mode 100644 index 0000000..49612f9 Binary files /dev/null and b/json2xml/json2xml.pyc differ diff --git a/readme.md b/readme.md index e69de29..e91d341 100644 --- a/readme.md +++ b/readme.md @@ -0,0 +1,19 @@ +##About + +This is a simple python module to conver json data to xml data. + + +### How to install + +``` +pip install json2xml +``` + +###How to use + +Check out the example given in examples directory. + + +###Bugs, features + +Create an issue in the repository diff --git a/setup.py b/setup.py index e69de29..5589fc6 100644 --- a/setup.py +++ b/setup.py @@ -0,0 +1,55 @@ +#! /usr/bin/env python + +import os +import sys + +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + +import json2xml + + + +def publish(): + """Publish to PyPi""" + os.system("python setup.py sdist upload") + +if sys.argv[-1] == "publish": + publish() + sys.exit() + +required = ['dict2xml'] + +setup( + name='json2xml', + version=json2xml.__version__, + description='Python Command-line Application Tools', + long_description=open('README.md').read() + '\n\n' + + open('HISTORY.md').read(), + author='Vinit Kumar', + author_email='vinit.kumar@changer.nl', + url='https://github.com/vinitcool76/json2xml', + data_files=[ + 'README.md', + 'HISTORY.md', + ], + install_requires=required, + license='MIT', + classifiers=( +# 'Development Status :: 5 - Production/Stable', + 'Environment :: Console', + 'Intended Audience :: Developers', + 'Natural Language :: English', + 'License :: OSI Approved :: ISC License (ISCL)', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.1', + 'Programming Language :: Python :: 3.2', + 'Topic :: Terminals :: Terminal Emulators/X Terminals', + ), +)