Skip to content

Commit

Permalink
adding the module with examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vinit kumar committed Jul 6, 2013
1 parent d815ca1 commit d36759c
Show file tree
Hide file tree
Showing 15 changed files with 176 additions and 0 deletions.
5 changes: 5 additions & 0 deletions History.md
@@ -0,0 +1,5 @@

n.n.n / 2013-07-07
==================

* added gitignore, readme and setup.py
Binary file added dist/json2xml-0.1-py2.7.egg
Binary file not shown.
5 changes: 5 additions & 0 deletions 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.

35 changes: 35 additions & 0 deletions 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()




29 changes: 29 additions & 0 deletions 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
6 changes: 6 additions & 0 deletions 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
1 change: 1 addition & 0 deletions json2xml.egg-info/dependency_links.txt
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions json2xml.egg-info/requires.txt
@@ -0,0 +1 @@
dict2xml
1 change: 1 addition & 0 deletions json2xml.egg-info/top_level.txt
@@ -0,0 +1 @@

1 change: 1 addition & 0 deletions json2xml/__init__.py
@@ -0,0 +1 @@
__version__ = 0.1
Binary file added json2xml/__init__.pyc
Binary file not shown.
18 changes: 18 additions & 0 deletions 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


Binary file added json2xml/json2xml.pyc
Binary file not shown.
19 changes: 19 additions & 0 deletions 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
55 changes: 55 additions & 0 deletions 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',
),
)

0 comments on commit d36759c

Please sign in to comment.