# Path: pgp/armor.py
# PGP_MESSAGE = 1
# PGP_PUBLIC_KEY_BLOCK = 2
# PGP_PRIVATE_KEY_BLOCK = 3
# PGP_SIGNATURE = 4
# DASHES = '-----'
# def is_armor(data):
#     def from_ascii(cls, text):
#     def __init__(self, data_type, data, part=None, total_parts=None,
#                  version=None, comment=None, message_id=None,
#                  hash_algorithms=None, charset=None, extra_headers=None):
#     def __str__(self):
#     def __bytes__(self):
# class ASCIIArmor(object):
# 
# Path: pgp/shortcuts.py
# def read_key(data, armored=False):
#     if armor.is_armor(data):
#         # Assume the user made a mistake
#         if isinstance(data, bytes):
#             data = data.decode('us-ascii')
#         armored = True
#     if armored:
#         fn = parse_ascii_packet_data
#     else:
#         fn = parse_binary_packet_data
# 
#     packets = list(fn(data))
# 
#     if packets[0].type == constants.PUBLIC_KEY_PACKET_TYPE:
#         return TransferablePublicKey.from_packets(packets)
#     elif packets[0].type == constants.SECRET_KEY_PACKET_TYPE:
#         return TransferableSecretKey.from_packets(packets)
#     else:
#         raise ValueError('Unexpected packet')


import datetime
import requests
from urllib.parse import unquote
from urllib.parse import urljoin
from urllib.parse import urlparse
from urllib.parse import urlunparse
from pgp import armor
from pgp.shortcuts import read_key
                user_ids.append(line)
            # Skip anything else

        if pub_key:
            results.append(HKPResult(self, pub_key, user_ids))

        return results

    def get(self, key_id, exact=False):
        response = requests.get(self.get_url, params={
            'op': 'get',
            'search': '0x{}'.format(key_id),
            'options': 'mr',
            'exact': 'yes' if exact else 'no',
            })
        response.raise_for_status()
        return read_key(response.content, True)

    def search(self, terms, exact=False):
        response = requests.get(self.get_url, params={
            'op': 'index',
            'options': 'mr',
            'search': terms,
            'exact': 'yes' if exact else 'no'
            })
        response.raise_for_status()
        return self._read_mr(response.text)

    def submit(self, key, no_modify=False):
        key_data = b''.join(map(bytes, key.to_packets()))

# Path: pgp/armor.py
# PGP_MESSAGE = 1
# PGP_PUBLIC_KEY_BLOCK = 2
# PGP_PRIVATE_KEY_BLOCK = 3
# PGP_SIGNATURE = 4
# DASHES = '-----'
# def is_armor(data):
#     def from_ascii(cls, text):
#     def __init__(self, data_type, data, part=None, total_parts=None,
#                  version=None, comment=None, message_id=None,
#                  hash_algorithms=None, charset=None, extra_headers=None):
#     def __str__(self):
#     def __bytes__(self):
# class ASCIIArmor(object):
# 
# Path: pgp/shortcuts.py
# def read_key(data, armored=False):
#     if armor.is_armor(data):
#         # Assume the user made a mistake
#         if isinstance(data, bytes):
#             data = data.decode('us-ascii')
#         armored = True
#     if armored:
#         fn = parse_ascii_packet_data
#     else:
#         fn = parse_binary_packet_data
# 
#     packets = list(fn(data))
# 
#     if packets[0].type == constants.PUBLIC_KEY_PACKET_TYPE:
#         return TransferablePublicKey.from_packets(packets)
#     elif packets[0].type == constants.SECRET_KEY_PACKET_TYPE:
#         return TransferableSecretKey.from_packets(packets)
#     else:
#         raise ValueError('Unexpected packet')


# Path: pgp/keyserver/hkp.py
import datetime
import requests
from urllib.parse import unquote
from urllib.parse import urljoin
from urllib.parse import urlparse
from urllib.parse import urlunparse
from pgp import armor
from pgp.shortcuts import read_key

                user_ids.append(line)
            # Skip anything else

        if pub_key:
            results.append(HKPResult(self, pub_key, user_ids))

        return results

    def get(self, key_id, exact=False):
        response = requests.get(self.get_url, params={
            'op': 'get',
            'search': '0x{}'.format(key_id),
            'options': 'mr',
            'exact': 'yes' if exact else 'no',
            })
        response.raise_for_status()
        return read_key(response.content, True)

    def search(self, terms, exact=False):
        response = requests.get(self.get_url, params={
            'op': 'index',
            'options': 'mr',
            'search': terms,
            'exact': 'yes' if exact else 'no'
            })
        response.raise_for_status()
        return self._read_mr(response.text)

    def submit(self, key, no_modify=False):
        key_data = b''.join(map(bytes, key.to_packets()))

        a = armor.ASCIIArmor(armor.PGP_PUBLIC_KEY_BLOCK, key_data)