Return mail headers
334201
public function getHeaders( $source, $continue = true )
  {
    if ( false !== ( $separator_pos = strpos( $source, "\r\n\r\n" ) ) )
    {
      if ( $continue && false !== strpos( $source, 'HTTP/1.1 100 Continue' ) )
      {
        $source = trim( substr( $source, $separator_pos + 4 ) );
        $source = $this->getHeaders( $source, false );
      }
      else
      {
        $source = trim( substr( $source, 0, $separator_pos ) );
      }

      return $source;
    }

    return '';
  }
1166629
def mailto_to_envelope(mailto_str):
    
    from alot.db.envelope import Envelope
    headers, body = parse_mailto(mailto_str)
    return Envelope(bodytext=body, headers=headers)
571431
def get_mail_addresses(message, header_name):
    
    headers = [h for h in message.get_all(header_name, [])]
    addresses = email.utils.getaddresses(headers)

    for index, (address_name, address_email) in enumerate(addresses):
        addresses[index] = {'name': decode_mail_header(address_name),
                            'email': address_email}
        logger.debug("{} Mail address in message: <{}> {}".format(
            header_name.upper(), address_name, address_email))
    return addresses
1237912
private static function getResponseHeaders()
    {
        $arh = array();

        // headers_list don't return associative array
        $headers = headers_list();
        foreach ($headers as $header) {
            $header = explode(':', $header);
            $arh[array_shift($header)] = trim(implode(':', $header));
        }

        return $arh;
    }
1330308
def get_smtp_mail(self):
        
        header = self.get_smtp_header()
        body = self.get_body().replace('\n', '\r\n')
        return header + '\r\n' + body + '\r\n'
386373
def collect_responses_and_parts_order(headers) #:nodoc:
      responses, parts_order = [], nil

      if block_given?
        collector = ActionMailer::Collector.new(lookup_context) { render(action_name) }
        yield(collector)
        parts_order = collector.responses.map { |r| r[:content_type] }
        responses  = collector.responses
      elsif headers[:body]
        responses << {
          :body => headers.delete(:body),
          :content_type => self.class.default[:content_type] || "text/plain"
        }
      else
        templates_path = headers.delete(:template_path) || self.class.mailer_name
        templates_name = headers.delete(:template_name) || action_name
        each_template(templates_path, templates_name) do |template|
          self.formats = template.formats
          responses <<  if lookup_context.view_paths.detect {|resolver| resolver.class.to_s == "MailEngine::MailTemplateResolver" }
                          {
                            :body => render_with_layout_and_partials(template.mime_type.to_sym.to_s),
                            :content_type => template.mime_type.to_s
                          }
                        else
                          {
                            :body => render(:template => template),
                            :content_type => template.mime_type.to_s
                          }
                        end
        end
      end

      [responses, parts_order]
    end
996662
function transport(message) {
    return {
      header: message.header,
      request: message.request,
      response: message.response
    }
  }
1182440
function getResponseHeaders($options = array()){
		$options = array_merge(array(
			"as_hash" => false,
			"lowerize_keys" => false
		),$options);

		$this->fetchContent();

		$out = $this->_ResponseHeaders;

		if($options["as_hash"]){
			$headers = explode("\n",$out);
			$out = array();
			foreach($headers as $h){
				if(preg_match("/^([^ ]+):(.*)/",trim($h),$matches)){
					$key = $options["lowerize_keys"] ? strtolower($matches[1]) : $matches[1];
					$out[$key] = trim($matches[2]);
				}
			}
		}

		return $out;
	}
764391
public function getHeaders(): Headers
    {
        if (null === $this->headers) {
            $this->headers = new Headers(\imap_rfc822_parse_headers($this->getRawHeaders()));
        }

        return $this->headers;
    }
761803
def get_headers(self):
        """"""

        try:
            return {
                'X-Auth-User': self.job_args['os_user'],
                'X-Auth-Key': self.job_args['os_apikey']
            }
        except KeyError as exp:
            raise exceptions.AuthenticationProblem(
                'Missing Credentials. Error: %s',
                exp
            )
107438
def parse_email_headers(s)
		keys={}
		match = (s =~ /\A((\w[\w\s\_\-]+: .*\n)+)\s*\n/)
		if match != 0
			keys[:data] = s
		else
			keys[:data] = $'
			headers = $1
			headers.split("\n").each do |l| 
# Fails if there are other ':' characters.
#				k, v = l.split(':')
				k, v = l.split(':', 2)
				k, v = normalize_key_and_value(k, v)
				k = k.to_sym
#				puts "K = #{k}, V=#{v}"
				keys[k] = v
			end
		end
		keys
	end
409322
def _get_headers(self):
        """"""
        headers = {
            'user-agent': 'IPinfoClient/Python{version}/1.0'.format(version=sys.version_info[0]),
            'accept': 'application/json'
        }

        if self.access_token:
            headers['authorization'] = 'Bearer {}'.format(self.access_token)

        return headers
871731
def headers(self):
        '''  '''
        self.__dict__['headers'] = hdict = HeaderDict()
        hdict.dict = self._headers
        return hdict
1266638
def _filter_headers(self):
        
        headers = {}
        for user in self.usernames:
            headers["fedora_messaging_user_{}".format(user)] = True
        for package in self.packages:
            headers["fedora_messaging_rpm_{}".format(package)] = True
        for container in self.containers:
            headers["fedora_messaging_container_{}".format(container)] = True
        for module in self.modules:
            headers["fedora_messaging_module_{}".format(module)] = True
        for flatpak in self.flatpaks:
            headers["fedora_messaging_flatpak_{}".format(flatpak)] = True
        return headers
580885
def recipients(self):
        
        return [email for email in (self.to + self.cc + self.bcc) if email]
364795
def get_user_by_email(self, email):
		""""""

		call = "/api/users/"+ str(email)

		return self.api_call(call=call, method="GET")
287110
def get_from_headers(request, key):
    
    value = request.headers.get(key)
    return to_native(value)