postkr

package module
v0.0.0-...-55eb0e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 6, 2018 License: BSD-2-Clause Imports: 8 Imported by: 0

README

About postkr

인터넷 우체국 오픈API를 위한 Go언어 패키지 입니다.

현재, 우편번호, 종추적조회, EMS 중 우편번호 기능 만 구현되어 있습니다.

Documentation

Prerequisites

Install Go

Installation

$ go get github.com/suapapa/go_postkr

General Documentation

godoc.org 링크에서 온라인 문서를 보거나, 다음 명령으로 로컬에서 문서를 볼 수 있습니다.

go doc github.com/suapapa/go_postkr

Example

postkr을 사용하려면, 인터넷 우체국의 오픈API사용신청을 통해 키를 발급 받아야 합니다. 발급받은 키를 아래 코드의 yourKey 변수에 할당하세요.

package main

import (
        "fmt"
        "github.com/suapapa/go_postkr"
)

func main() {
        // 발급받은 오픈API 키로 바꾸세요
        yourKey := "abcedfghijklmnopqrstuvwxyz1234"

        s := postkr.NewService(yourKey)
        l, err := s.SerchZipCode("내곡동")
        if err != nil {
                fmt.Println(err)
                return
        }

        for _, p := range l {
                fmt.Printf("(%s) %s\n", p.Code, p.Address)
        }
}

실행 결과

$ go run postkr.go
(137180) 서울 서초구 내곡동
(412260) 경기 고양시 덕양구 내곡동
(210160) 강원 강릉시 내곡동
(210701) 강원 강릉시 내곡동 관동대
...

Author

Homin Lee <homin.lee@suapapa.net>

Copyright (c) 2012, Homin Lee. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

Documentation

Overview

Package postkr provides access to APIs of epost.kr, Korean post office.

http://biz.epost.go.kr/eportal/custom/custom_9.jsp?subGubun=sub_3&subGubun_1=cum_17&gubun=m07

The epost.kr provide APIs for track snail-mail and search zip-code. But, I can't access to the tracking API with my key. So, It's not implemented currently.

You need own key which is issued by eport.kr. Get one from this link:

http://biz.epost.go.kr/eportal/custom/custom_11.jsp?subGubun=sub_3&subGubun_1=cum_19&gubun=m07

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	TotalCount, TotalPage     int
	CountPerPage, CurrentPage int
	// contains filtered or unexported fields
}

Service represents epost.kr's post services

func NewService

func NewService(regkey string) *Service

NewService returns new Service. Call it with regkey.

func (*Service) SearchZipCode

func (s *Service) SearchZipCode(key string) ([]Zipcode, error)

SearchZipCode get Zipcodes for given [읍면동교] of an address.

func (*Service) SearchZipCode5

func (s *Service) SearchZipCode5(key string, countPerPage, currentPage int) ([]Zipcode, error)

SearchZipCode5 search new format of zipcode with road based address

  • countPerPage : 페이지당 조회 건수
  • currentPage : 조회할 페이지 번호

type Zipcode

type Zipcode struct {
	XMLName xml.Name `xml:"item"`
	// Address: The address of the zipcode
	Address string `xml:"address"`
	// Code: The zip code number
	Code string `xml:"postcd"`
}

Zipcode represents snailmail's zip code

func (Zipcode) Codenum

func (p Zipcode) Codenum() uint

Codenum get zip code in uint

func (Zipcode) String

func (p Zipcode) String() string

String get string of Zipcode in form of "XXXXXX:Address of XXXXXX"

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL