From 7e3aead559780664f1d5773ce0a02c8d34c831fc Mon Sep 17 00:00:00 2001 From: Thiago Avelino Date: Tue, 28 Dec 2010 03:42:42 -0200 Subject: [PATCH] update --- AUTHORS | 2 - COPYRIGHT | 0 LICENSE | 22 ---------- MANIFEST.in | 3 -- README.markdown | 9 ----- changelog.txt | 5 --- demo.py | 13 ------ pycorreios/__init__.py | 18 --------- pycorreios/cod.py | 8 ---- pycorreios/correios.py | 92 ------------------------------------------ setup.py | 47 --------------------- 11 files changed, 219 deletions(-) delete mode 100644 AUTHORS delete mode 100644 COPYRIGHT delete mode 100644 LICENSE delete mode 100644 MANIFEST.in delete mode 100644 README.markdown delete mode 100644 changelog.txt delete mode 100644 demo.py delete mode 100644 pycorreios/__init__.py delete mode 100644 pycorreios/cod.py delete mode 100644 pycorreios/correios.py delete mode 100644 setup.py diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index c358223..0000000 --- a/AUTHORS +++ /dev/null @@ -1,2 +0,0 @@ -Thiago Avelino -Dilan Nery diff --git a/COPYRIGHT b/COPYRIGHT deleted file mode 100644 index e69de29..0000000 diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 327340a..0000000 --- a/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2009-2010 Thiago Avelino - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index b83daed..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,3 +0,0 @@ -include MANIFEST.in -include LICENSE -include AUTHORS diff --git a/README.markdown b/README.markdown deleted file mode 100644 index 6ee7df4..0000000 --- a/README.markdown +++ /dev/null @@ -1,9 +0,0 @@ -API Correios -============ - -Authors: --------- - -Thiago Avelino () - -Dilan Nery () diff --git a/changelog.txt b/changelog.txt deleted file mode 100644 index ac1fa31..0000000 --- a/changelog.txt +++ /dev/null @@ -1,5 +0,0 @@ -2010-12-24 Dilan Nery - - * correios.py (frete): created - - * correios.py (constates__tipo_de_envio): created diff --git a/demo.py b/demo.py deleted file mode 100644 index 875e33d..0000000 --- a/demo.py +++ /dev/null @@ -1,13 +0,0 @@ -# -*- coding: utf-8 -*- -from pycorreios import Correios - -test = Correios().frete(Correios().SEDEX,'44001535','03971010',10,18,8) -if test['Erro'] != '0': - print 'Deu erro! :(' - print test['Erro'] - print test['MsgErro'] -else: - print "Valor: %s\nPrazo de Entrega: %s" % (test['Valor'],test['PrazoEntrega']) - -other_test = Correios().cep(44010000) -print other_test['bairro'] diff --git a/pycorreios/__init__.py b/pycorreios/__init__.py deleted file mode 100644 index 011bf5e..0000000 --- a/pycorreios/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -import correios -from correios import * -import cod -from cod import * - -# __all__ = (correios.__all__ + cod.__all__) - -__author__ = 'Thaigo Avelino' - -VERSION = (0, 1, 0) - -def get_version(): - version = '%s.%s' % (VERSION[0], VERSION[1]) - if VERSION[2]: - version = '%s.%s' % (version, VERSION[2]) - return version - -__version__ = get_version() diff --git a/pycorreios/cod.py b/pycorreios/cod.py deleted file mode 100644 index fca21cb..0000000 --- a/pycorreios/cod.py +++ /dev/null @@ -1,8 +0,0 @@ -PAC = 41106 -SEDEX = 40010 -SEDEX_10 = 40215 -SEDEX_HOJE = 40290 -E_SEDEX = 81019 -OTE = 44105 -NORMAL = 41017 -SEDEX_A_COBRAR = 40045 diff --git a/pycorreios/correios.py b/pycorreios/correios.py deleted file mode 100644 index 634c3aa..0000000 --- a/pycorreios/correios.py +++ /dev/null @@ -1,92 +0,0 @@ -# -*- coding: utf-8 -*- -""" -correios.py ----------- - -Api para usar dados dos Correios -""" - -__version__ = '0.1.0' -__author__ = { - 'Thiago Avelino': 'thiagoavelinoster@gmail.com', - 'Dilan Nery': 'dnerylopes@gmail.com', - } - -import urllib2 -import sys -from xml.dom import minidom - -import cod - -class Correios(object): - def __init__(self): - self.status = 'OK' - self.PAC = 41106 - self.SEDEX = 40010 - self.SEDEX_10 = 40215 - self.SEDEX_HOJE = 40290 - self.E_SEDEX = 81019 - self.OTE = 44105 - self.NORMAL = 41017 - self.SEDEX_A_COBRAR = 40045 - - def _getDados(self,tags_name, dom): - dados = {} - - for tag_name in tags_name: - try: - dados[tag_name] = dom.getElementsByTagName(tag_name)[0] - dados[tag_name] = dados[tag_name].childNodes[0].data - except: - dados[tag_name] = '' - - return dados - - def frete(self,cod,GOCEP,HERECEP,peso, - comprimento,diametro,toback='xml'): - - url = "http://ws.correios.com.br/calculador/CalcPrecoPrazo.aspx?\ - StrRetorno=%s\ - &nCdServico=%s\ - &nVlPeso=%i\ - &sCepOrigem=%s\ - &sCepDestino=%s\ - &nVlComprimento=%s\ - &nVlDiametro=%s" % (toback,cod,peso,HERECEP, - GOCEP,comprimento,diametro) - dom = minidom.parse(urllib2.urlopen(url)) - - tags_name = ('MsgErro', - 'Erro', - 'Codigo', - 'Valor', - 'PrazoEntrega', - 'ValorMaoPropria', - 'ValorValorDeclarado', - 'EntregaDomiciliar', - 'EntregaSabado', - ) - - return self._getDados(tags_name, dom) - - def cep(self,numero): - url = 'http://cep.republicavirtual.com.br/web_cep.php?\ - formato=xml&cep=%s' % (str(numero)) - dom = minidom.parse(urllib2.urlopen(url)) - - tags_name = ('uf', - 'cidade', - 'bairro', - 'tipo_logradouro', - 'logradouro', - ) - - resultado = dom.getElementsByTagName('resultado')[0] - resultado = int(resultado.childNodes[0].data) - if resultado != 0: - return self._getDados(tags_name, dom) - else: - return {} - -# Delete the modules to not show up in the namespace -# del urllib2, sys, minidom diff --git a/setup.py b/setup.py deleted file mode 100644 index 429fdc2..0000000 --- a/setup.py +++ /dev/null @@ -1,47 +0,0 @@ -from setuptools import setup, find_packages -import os - -DESCRIPTION = "API for correios in Python" - -LONG_DESCRIPTION = None -try: - LONG_DESCRIPTION = open('README.markdown').read() -except: - pass - -def get_version(version_tuple): - version = '%s.%s' % (version_tuple[0], version_tuple[1]) - if version_tuple[2]: - version = '%s.%s' % (version, version_tuple[2]) - return version - -# Dirty hack to get version number from pycorreios/__init__.py - we can't -# file is read -init = os.path.join(os.path.dirname(__file__), 'pycorreios', '__init__.py') -version_line = filter(lambda l: l.startswith('VERSION'), open(init))[0] -VERSION = get_version(eval(version_line.split('=')[-1])) -print VERSION - -CLASSIFIERS = [ - 'Development Status :: 4 - Beta', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: MIT License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Topic :: Software Development :: Libraries :: Python Modules', -] - -setup(name='pycorreios', - version=VERSION, - packages=find_packages(), - author='Thiago Avelino', - author_email='thiagoavelinoster@gmail.com', - url='https://github.com/avelino/pycorreios/', - license='MIT', - include_package_data=True, - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - platforms=['any'], - classifiers=CLASSIFIERS, - test_suite='tests', -)