Linux biogene 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache
: 46.101.124.208 | : 3.145.36.228
Cant Read [ /etc/named.conf ]
5.6.40-0+deb8u12
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
lib /
python2.7 /
dist-packages /
[ HOME SHELL ]
Name
Size
Permission
Action
Cheetah
[ DIR ]
drwxr-xr-x
Cheetah-2.4.4.egg-info
[ DIR ]
drwxr-xr-x
Crypto
[ DIR ]
drwxr-xr-x
Jinja2-2.8.egg-info
[ DIR ]
drwxr-xr-x
MarkupSafe-0.23.egg-info
[ DIR ]
drwxr-xr-x
MySQLdb
[ DIR ]
drwxr-xr-x
OpenSSL
[ DIR ]
drwxr-xr-x
PIL
[ DIR ]
drwxr-xr-x
Pillow-4.0.0.egg-info
[ DIR ]
drwxr-xr-x
Pygments-2.2.0.egg-info
[ DIR ]
drwxr-xr-x
SOAPpy
[ DIR ]
drwxr-xr-x
SOAPpy-0.12.22.egg-info
[ DIR ]
drwxr-xr-x
SQLAlchemy-1.0.15.egg-info
[ DIR ]
drwxr-xr-x
apt
[ DIR ]
drwxr-xr-x
aptsources
[ DIR ]
drwxr-xr-x
bcrypt
[ DIR ]
drwxr-xr-x
bcrypt-3.1.2.egg-info
[ DIR ]
drwxr-xr-x
beautifulsoup4-4.5.3.egg-info
[ DIR ]
drwxr-xr-x
boto
[ DIR ]
drwxr-xr-x
boto-2.44.0.egg-info
[ DIR ]
drwxr-xr-x
bs4
[ DIR ]
drwxr-xr-x
cffi
[ DIR ]
drwxr-xr-x
cffi-1.9.1.egg-info
[ DIR ]
drwxr-xr-x
chardet
[ DIR ]
drwxr-xr-x
chardet-2.3.0.egg-info
[ DIR ]
drwxr-xr-x
cloudinit
[ DIR ]
drwxr-xr-x
colorama
[ DIR ]
drwxr-xr-x
colorama-0.3.7.egg-info
[ DIR ]
drwxr-xr-x
configobj-5.0.6.egg-info
[ DIR ]
drwxr-xr-x
cryptography
[ DIR ]
drwxr-xr-x
cryptography-1.7.1.egg-info
[ DIR ]
drwxr-xr-x
curl
[ DIR ]
drwxr-xr-x
dbus
[ DIR ]
drwxr-xr-x
debian
[ DIR ]
drwxr-xr-x
debian_bundle
[ DIR ]
drwxr-xr-x
defusedxml
[ DIR ]
drwxr-xr-x
distlib
[ DIR ]
drwxr-xr-x
distlib-0.2.4.egg-info
[ DIR ]
drwxr-xr-x
distro_info-0.14.egg-info
[ DIR ]
drwxr-xr-x
distro_info_test
[ DIR ]
drwxr-xr-x
docutils
[ DIR ]
drwxr-xr-x
ecdsa
[ DIR ]
drwxr-xr-x
enum
[ DIR ]
drwxr-xr-x
enum34-1.1.6.egg-info
[ DIR ]
drwxr-xr-x
euca2ools
[ DIR ]
drwxr-xr-x
euca2ools-3.3_devel.egg-info
[ DIR ]
drwxr-xr-x
flup
[ DIR ]
drwxr-xr-x
flup-1.0.2.egg-info
[ DIR ]
drwxr-xr-x
gi
[ DIR ]
drwxr-xr-x
html5lib
[ DIR ]
drwxr-xr-x
html5lib-0.999999999.egg-info
[ DIR ]
drwxr-xr-x
httplib2
[ DIR ]
drwxr-xr-x
idna
[ DIR ]
drwxr-xr-x
idna-2.2.egg-info
[ DIR ]
drwxr-xr-x
ipaddress-1.0.17.egg-info
[ DIR ]
drwxr-xr-x
jinja2
[ DIR ]
drwxr-xr-x
jsonpatch-1.10.egg-info
[ DIR ]
drwxr-xr-x
jsonpointer-1.10.egg-info
[ DIR ]
drwxr-xr-x
keyring
[ DIR ]
drwxr-xr-x
keyring-10.1.egg-info
[ DIR ]
drwxr-xr-x
keyrings
[ DIR ]
drwxr-xr-x
keyrings.alt-1.3.egg-info
[ DIR ]
drwxr-xr-x
ldap
[ DIR ]
drwxr-xr-x
lxml
[ DIR ]
drwxr-xr-x
lxml-3.7.1.egg-info
[ DIR ]
drwxr-xr-x
markupsafe
[ DIR ]
drwxr-xr-x
mysqlclient-1.3.7.egg-info
[ DIR ]
drwxr-xr-x
ndg
[ DIR ]
drwxr-xr-x
ndg_httpsclient-0.4.2.egg-info
[ DIR ]
drwxr-xr-x
netifaces-0.10.4.egg-info
[ DIR ]
drwxr-xr-x
oauth
[ DIR ]
drwxr-xr-x
oauth-1.0.1.egg-info
[ DIR ]
drwxr-xr-x
paramiko
[ DIR ]
drwxr-xr-x
paramiko-2.0.0.egg-info
[ DIR ]
drwxr-xr-x
pip
[ DIR ]
drwxr-xr-x
pip-1.5.6.egg-info
[ DIR ]
drwxr-xr-x
pkg_resources
[ DIR ]
drwxr-xr-x
ply
[ DIR ]
drwxr-xr-x
ply-3.9.egg-info
[ DIR ]
drwxr-xr-x
prettytable-0.7.2.egg-info
[ DIR ]
drwxr-xr-x
pyOpenSSL-16.2.0.egg-info
[ DIR ]
drwxr-xr-x
pyasn1
[ DIR ]
drwxr-xr-x
pyasn1-0.1.9.egg-info
[ DIR ]
drwxr-xr-x
pycparser
[ DIR ]
drwxr-xr-x
pygments
[ DIR ]
drwxr-xr-x
pygtkcompat
[ DIR ]
drwxr-xr-x
pysimplesoap
[ DIR ]
drwxr-xr-x
python_debian-0.1.30.egg-info
[ DIR ]
drwxr-xr-x
reportbug
[ DIR ]
drwxr-xr-x
reportbug-6.6.3.egg-info
[ DIR ]
drwxr-xr-x
requestbuilder
[ DIR ]
drwxr-xr-x
requestbuilder-devel.egg-info
[ DIR ]
drwxr-xr-x
requests
[ DIR ]
drwxr-xr-x
requests-2.12.4.egg-info
[ DIR ]
drwxr-xr-x
secretstorage
[ DIR ]
drwxr-xr-x
serial
[ DIR ]
drwxr-xr-x
setuptools
[ DIR ]
drwxr-xr-x
setuptools-33.1.1.egg-info
[ DIR ]
drwxr-xr-x
six-1.10.0.egg-info
[ DIR ]
drwxr-xr-x
softwareproperties
[ DIR ]
drwxr-xr-x
sqlalchemy
[ DIR ]
drwxr-xr-x
urllib3
[ DIR ]
drwxr-xr-x
urllib3-1.19.1.egg-info
[ DIR ]
drwxr-xr-x
virtualenv-1.11.6.egg-info
[ DIR ]
drwxr-xr-x
web
[ DIR ]
drwxr-xr-x
webencodings
[ DIR ]
drwxr-xr-x
webencodings-0.5.egg-info
[ DIR ]
drwxr-xr-x
wheel
[ DIR ]
drwxr-xr-x
wheel-0.29.0.egg-info
[ DIR ]
drwxr-xr-x
wstools
[ DIR ]
drwxr-xr-x
wstools-0.4.3.egg-info
[ DIR ]
drwxr-xr-x
xdg
[ DIR ]
drwxr-xr-x
yaml
[ DIR ]
drwxr-xr-x
BeautifulSoup-3.2.1.egg-info
970
B
-rw-r--r--
BeautifulSoup.py
77.7
KB
-rw-r--r--
BeautifulSoup.pyc
67.55
KB
-rw-r--r--
BeautifulSoupTests.py
36.71
KB
-rw-r--r--
BeautifulSoupTests.pyc
40.56
KB
-rw-r--r--
PyYAML-3.12.egg-info
1.48
KB
-rw-r--r--
README
119
B
-rw-r--r--
SecretStorage-2.3.1.egg-info
4.09
KB
-rw-r--r--
_cffi_backend.x86_64-linux-gnu...
157.13
KB
-rw-r--r--
_dbus_bindings.x86_64-linux-gn...
159.3
KB
-rw-r--r--
_dbus_glib_bindings.x86_64-lin...
10.78
KB
-rw-r--r--
_ldap.x86_64-linux-gnu.so
68.48
KB
-rw-r--r--
_mysql.x86_64-linux-gnu.so
61.8
KB
-rw-r--r--
_mysql_exceptions.py
2.3
KB
-rw-r--r--
_mysql_exceptions.pyc
4.13
KB
-rw-r--r--
_version.py
21
B
-rw-r--r--
_yaml.x86_64-linux-gnu.so
204.06
KB
-rw-r--r--
apt_inst.x86_64-linux-gnu.so
50.24
KB
-rw-r--r--
apt_pkg.x86_64-linux-gnu.so
338.34
KB
-rw-r--r--
configobj.py
87.51
KB
-rw-r--r--
deb822.py
146
B
-rw-r--r--
debconf.py
5.83
KB
-rw-r--r--
debconf.pyc
5.87
KB
-rw-r--r--
debianbts.py
16.51
KB
-rw-r--r--
defusedxml-0.4.1.egg-info
35.09
KB
-rw-r--r--
distro_info.py
9.26
KB
-rw-r--r--
distro_info.pyc
10.18
KB
-rw-r--r--
docutils-0.13.1.egg-info
2.31
KB
-rw-r--r--
dsml.py
8.06
KB
-rw-r--r--
dsml.pyc
9.27
KB
-rw-r--r--
easy_install.py
126
B
-rw-r--r--
ecdsa-0.13.egg-info
660
B
-rw-r--r--
httplib2-0.9.2.egg-info
2.22
KB
-rw-r--r--
ipaddress.py
78.3
KB
-rw-r--r--
jsonpatch.py
24.78
KB
-rw-r--r--
jsonpointer.py
9.15
KB
-rw-r--r--
jsonpointer.pyc
9.39
KB
-rw-r--r--
keyrings.alt-1.3-nspkg.pth
361
B
-rw-r--r--
ldapurl.py
11.66
KB
-rw-r--r--
ldapurl.pyc
13.21
KB
-rw-r--r--
ldif.py
18.11
KB
-rw-r--r--
ldif.pyc
17.15
KB
-rw-r--r--
lsb_release.py
12.43
KB
-rw-r--r--
ndg_httpsclient-0.4.2-nspkg.pt...
296
B
-rw-r--r--
netifaces.so
18.47
KB
-rw-r--r--
prettytable.py
52.93
KB
-rw-r--r--
prettytable.pyc
50.38
KB
-rw-r--r--
pycparser-2.17.egg-info
602
B
-rw-r--r--
pycrypto-2.6.1.egg-info
666
B
-rw-r--r--
pycurl-7.43.0.egg-info
4.43
KB
-rw-r--r--
pycurl.x86_64-linux-gnu.so
125.19
KB
-rw-r--r--
pygobject-3.22.0.egg-info
1013
B
-rw-r--r--
pyinotify-0.9.6.egg-info
1.39
KB
-rw-r--r--
pyinotify.py
87.35
KB
-rw-r--r--
pyserial-3.2.1.egg-info
1.58
KB
-rw-r--r--
python-support.pth
29
B
-rw-r--r--
python_apt-1.4.3.egg-info
226
B
-rw-r--r--
python_debianbts-2.6.1.egg-inf...
716
B
-rw-r--r--
python_ldap-2.4.28.egg-info
1.45
KB
-rw-r--r--
pyxdg-0.25.egg-info
576
B
-rw-r--r--
roman-2.0.0.egg-info
1.28
KB
-rw-r--r--
roman.py
2.63
KB
-rw-r--r--
six.py
29.39
KB
-rw-r--r--
validate.py
46.13
KB
-rw-r--r--
virtualenv.py
97.99
KB
-rw-r--r--
virtualenv.pyc
81.43
KB
-rw-r--r--
web.py-0.38.egg-info
301
B
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : debianbts.py
#!/usr/bin/env python # debianbts.py - Methods to query Debian's BTS. # Copyright (C) 2007-2015 Bastian Venthur <venthur@debian.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. """ Query Debian's Bug Tracking System (BTS). This module provides a layer between Python and Debian's BTS. It provides methods to query the BTS using the BTS' SOAP interface, and the Bugreport class which represents a bugreport from the BTS. """ from __future__ import division, unicode_literals, absolute_import, print_function import base64 import email.feedparser from datetime import datetime import os import sys from pysimplesoap.client import SoapClient from pysimplesoap.simplexml import SimpleXMLElement # Support running from Debian infrastructure ca_path = '/etc/ssl/ca-debian' if os.path.isdir(ca_path): os.environ['SSL_CERT_DIR'] = ca_path # please follow the semver semantics, i.e. MAJOR.MINOR.PATCH where # MAJOR: incompatible API changes # MINOR: add backwards-compatible functionality # PATCH: backwards-compatible bug fixes. __version__ = '2.6.1' PY2 = sys.version_info.major == 2 # Setup the soap server # Default values URL = 'https://bugs.debian.org/cgi-bin/soap.cgi' NS = 'Debbugs/SOAP/V1' BTS_URL = 'https://bugs.debian.org/' # Max number of bugs to send in a single get_status request BATCH_SIZE = 500 class Bugreport(object): """Represents a bugreport from Debian's Bug Tracking System. A bugreport object provides all attributes provided by the SOAP interface. Most of the attributes are strings, the others are marked. Attributes ---------- bug_num : int The bugnumber severity : str Severity of the bugreport tags : list of strings Tags of the bugreport subject : str The subject/title of the bugreport originator : str Submitter of the bugreport mergedwith : list of ints List of bugnumbers this bug was merged with package : str Package of the bugreport source : str Source package of the bugreport date : datetime Date of bug creation log_modified : datetime Date of update of the bugreport done : boolean Is the bug fixed or not archived : bool Is the bug archived or not unarchived : bool Was the bug unarchived or not fixed_versions : list of strings List of versions, can be empty even if bug is fixed found_versions : list of strings List of version numbers where bug was found forwarded : str A URL or email address blocks: list of ints List of bugnumbers this bug blocks blockedby : list of int List of bugnumbers which block this bug pending : str Either 'pending' or 'done' msgid : str Message ID of the bugreport owner : str Who took responsibility for fixing this bug location : str Either 'db-h' or 'archive' affects : list of str List of Packagenames summary : str Arbitrary text """ def __init__(self): self.originator = None self.date = None self.subject = None self.msgid = None self.package = None self.tags = None self.done = None self.forwarded = None self.mergedwith = None self.severity = None self.owner = None self.found_versions = None self.fixed_versions = None self.blocks = None self.blockedby = None self.unarchived = None self.summary = None self.affects = None self.log_modified = None self.location = None self.archived = None self.bug_num = None self.source = None self.pending = None # The ones below are also there but not used # self.fixed = None # self.found = None # self.fixed_date = None # self.found_date = None # self.keywords = None # self.id = None def __unicode__(self): s = '\n'.join('{}: {}'.format(key, value) for key, value in self.__dict__.items()) return s + '\n' if PY2: def __str__(self): return self.__unicode__().encode('utf-8') else: __str__ = __unicode__ def __lt__(self, other): """Compare a bugreport with another. The more open and urgent a bug is, the greater the bug is: outstanding > resolved > archived critical > grave > serious > important > normal > minor > wishlist. Openness always beats urgency, eg an archived bug is *always* smaller than an outstanding bug. This sorting is useful for displaying bugreports in a list and sorting them in a useful way. """ return self._get_value() < other._get_value() def __le__(self, other): return not self.__gt__(other) def __gt__(self, other): return self._get_value() > other._get_value() def __ge__(self, other): return not self.__lt__(other) def __eq__(self, other): return self._get_value() == other._get_value() def __ne__(self, other): return not self.__eq__(other) def _get_value(self): if self.archived: # archived and done val = 0 elif self.done: # not archived and done val = 10 else: # not done val = 20 val += {"critical": 7, "grave": 6, "serious": 5, "important": 4, "normal": 3, "minor": 2, "wishlist": 1}[self.severity] return val def get_status(*nrs): """Returns a list of Bugreport objects. Given a list of bugnumbers this method returns a list of Bugreport objects. Parameters ---------- nrs : int or list of ints the bugnumbers Returns ------- bugs : list of Bugreport objects """ # If we called get_status with one single bug, we get a single bug, # if we called it with a list of bugs, we get a list, # No available bugreports returns an empty list bugs = [] list_ = [] for nr in nrs: if isinstance(nr, list): list_.extend(nr) else: list_.append(nr) # Process the input in batches to avoid hitting resource limits on the BTS soap_client = _build_soap_client() for i in range(0, len(list_), BATCH_SIZE): slice_ = list_[i:i + BATCH_SIZE] # I build body by hand, pysimplesoap doesn't generate soap Arrays # without using wsdl method_el = SimpleXMLElement('<get_status></get_status>') _build_int_array_el('arg0', method_el, slice_) reply = soap_client.call('get_status', method_el) for bug_item_el in reply('s-gensym3').children() or []: bug_el = bug_item_el.children()[1] bugs.append(_parse_status(bug_el)) return bugs def get_usertag(email, *tags): """Get buglists by usertags. Parameters ---------- email : str tags : tuple of strings If tags are given the dictionary is limited to the matching tags, if no tags are given all available tags are returned. Returns ------- mapping : dict a mapping of usertag -> buglist """ reply = _soap_client_call('get_usertag', email, *tags) map_el = reply('s-gensym3') mapping = {} # element <s-gensys3> in response can have standard type # xsi:type=apachens:Map (example, for email debian-python@lists.debian.org) # OR no type, in this case keys are the names of child elements and # the array is contained in the child elements type_attr = map_el.attributes().get('xsi:type') if type_attr and type_attr.value == 'apachens:Map': for usertag_el in map_el.children() or []: tag = _uc(str(usertag_el('key'))) buglist_el = usertag_el('value') mapping[tag] = [int(bug) for bug in buglist_el.children() or []] else: for usertag_el in map_el.children() or []: tag = _uc(usertag_el.get_name()) mapping[tag] = [int(bug) for bug in usertag_el.children() or []] return mapping def get_bug_log(nr): """Get Buglogs. A buglog is a dictionary with the following mappings: * "header" => string * "body" => string * "attachments" => list * "msg_num" => int * "message" => email.message.Message Parameters ---------- nr : int the bugnumber Returns ------- buglogs : list of dicts """ reply = _soap_client_call('get_bug_log', nr) items_el = reply('soapenc:Array') buglogs = [] for buglog_el in items_el.children(): buglog = {} buglog["header"] = _parse_string_el(buglog_el("header")) buglog["body"] = _parse_string_el(buglog_el("body")) buglog["msg_num"] = int(buglog_el("msg_num")) # server always returns an empty attachments array ? buglog["attachments"] = [] mail_parser = email.feedparser.FeedParser() mail_parser.feed(buglog["header"]) mail_parser.feed(buglog["body"]) buglog["message"] = mail_parser.close() buglogs.append(buglog) return buglogs def newest_bugs(amount): """Returns the newest bugs. This method can be used to query the BTS for the n newest bugs. Parameters ---------- amount : int the number of desired bugs. E.g. if `amount` is 10 the method will return the 10 latest bugs. Returns ------- bugs : list of int the bugnumbers """ reply = _soap_client_call('newest_bugs', amount) items_el = reply('soapenc:Array') return [int(item_el) for item_el in items_el.children() or []] def get_bugs(*key_value): """Get list of bugs matching certain criteria. The conditions are defined by key value pairs. Possible keys are: * "package": bugs for the given package * "submitter": bugs from the submitter * "maint": bugs belonging to a maintainer * "src": bugs belonging to a source package * "severity": bugs with a certain severity * "status": can be either "done", "forwarded", or "open" * "tag": see http://www.debian.org/Bugs/Developer#tags for available tags * "owner": bugs which are assigned to `owner` * "bugs": takes single int or list of bugnumbers, filters the list according to given criteria * "correspondent": bugs where `correspondent` has sent a mail to Arguments --------- key_value : str Returns ------- bugs : list of ints the bugnumbers Examples -------- >>> get_bugs('package', 'gtk-qt-engine', 'severity', 'normal') [12345, 23456] """ # previous versions also accepted get_bugs(['package', 'gtk-qt-engine', 'severity', 'normal']) # if key_value is a list in a one elemented tuple, remove the # wrapping list if len(key_value) == 1 and isinstance(key_value[0], list): key_value = tuple(key_value[0]) # pysimplesoap doesn't generate soap Arrays without using wsdl # I build body by hand, converting list to array and using standard # pysimplesoap marshalling for other types method_el = SimpleXMLElement('<get_bugs></get_bugs>') for arg_n, kv in enumerate(key_value): arg_name = 'arg' + str(arg_n) if isinstance(kv, (list, tuple)): _build_int_array_el(arg_name, method_el, kv) else: method_el.marshall(arg_name, kv) soap_client = _build_soap_client() reply = soap_client.call('get_bugs', method_el) items_el = reply('soapenc:Array') return [int(item_el) for item_el in items_el.children() or []] def _parse_status(bug_el): """Return a bugreport object from a given status xml element""" bug = Bugreport() # plain fields for field in ('originator', 'subject', 'msgid', 'package', 'severity', 'owner', 'summary', 'location', 'source', 'pending', 'forwarded'): setattr(bug, field, _parse_string_el(bug_el(field))) bug.date = datetime.utcfromtimestamp(float(bug_el('date'))) bug.log_modified = datetime.utcfromtimestamp(float(bug_el('log_modified'))) bug.tags = [_uc(tag) for tag in str(bug_el('tags')).split()] bug.done = _parse_bool(bug_el('done')) bug.archived = _parse_bool(bug_el('archived')) bug.unarchived = _parse_bool(bug_el('unarchived')) bug.bug_num = int(bug_el('bug_num')) bug.mergedwith = [int(i) for i in str(bug_el('mergedwith')).split()] bug.blockedby = [int(i) for i in str(bug_el('blockedby')).split()] bug.blocks = [int(i) for i in str(bug_el('blocks')).split()] bug.found_versions = [_uc(str(el)) for el in bug_el('found_versions').children() or []] bug.fixed_versions = [_uc(str(el)) for el in bug_el('fixed_versions').children() or []] affects = [_f for _f in str(bug_el('affects')).split(',') if _f] bug.affects = [_uc(a).strip() for a in affects] # Also available, but unused or broken # bug.keywords = [_uc(keyword) for keyword in # str(bug_el('keywords')).split()] # bug.fixed = _parse_crappy_soap(tmp, "fixed") # bug.found = _parse_crappy_soap(tmp, "found") # bug.found_date = [datetime.utcfromtimestamp(i) for i in tmp["found_date"]] # bug.fixed_date = [datetime.utcfromtimestamp(i) for i in tmp["fixed_date"]] return bug # to support python 3.4.3, when using httplib2 as pysimplesoap transport we must # work around a bug in httplib2, which uses http.client.HTTPSConnection with # check_hostname=True, but with an empty ssl context that prevents the # certificate verification. Passing `cacert` to httplib2 through pysimplesoap # permits to create a valid ssl context. _soap_client_kwargs = {'location': URL, 'namespace': NS, 'soap_ns': 'soap'} if sys.version_info.major == 3 and sys.version_info < (3, 4, 3): try: from httplib2 import CA_CERTS except ImportError: pass else: _soap_client_kwargs['cacert'] = CA_CERTS def _build_soap_client(): """Factory method that creates a SoapClient. For thread-safety we create SoapClients on demand instead of using a module-level one. Returns ------- sc : SoapClient instance """ return SoapClient(**_soap_client_kwargs) def _soap_client_call(method_name, *args): """wrapper to work around a pysimplesoap bug https://github.com/pysimplesoap/pysimplesoap/issues/31""" soap_client = _build_soap_client() soap_args = [] for arg_n, arg in enumerate(args): soap_args.append(('arg' + str(arg_n), arg)) return getattr(soap_client, method_name)(soap_client, *soap_args) def _build_int_array_el(el_name, parent, list_): """build a soapenc:Array made of ints called `el_name` as a child of `parent`""" el = parent.add_child(el_name) el.add_attribute('xmlns:soapenc', 'http://schemas.xmlsoap.org/soap/encoding/') el.add_attribute('xsi:type', 'soapenc:Array') el.add_attribute('soapenc:arrayType', 'xsd:int[{:d}]'.format(len(list_))) for item in list_: item_el = el.add_child('item', str(item)) item_el.add_attribute('xsi:type', 'xsd:int') return el def _parse_bool(el): """parse a boolean value from a xml element""" value = str(el) return not value.strip() in ('', '0') def _parse_string_el(el): """read a string element, maybe encoded in base64""" value = str(el) el_type = el.attributes().get('xsi:type') if el_type and el_type.value == 'xsd:base64Binary': value = base64.b64decode(value) if not PY2: value = value.decode('utf-8', errors='replace') value = _uc(value) return value """ Convert string to unicode. This method only exists to unify the unicode conversion in this module. """ if PY2: def _uc(string): return string.decode('utf-8', 'replace') else: def _uc(string): return string
Close