Using GET and POST with HTTP header authorization in Python

I'm trying to get a list of the Maps I created in Google Maps and the Maps API says the following:


Getting a list of cards

The map data API provides a feed listing the maps created by a specific user; this feed is known as a metafile. A typical metadata for the Maps data API is a GET request of the following form:

The default channel requests all cards associated with an authenticated user.

GET http://maps.google.com/maps/feeds/maps/default/full
Authorization: GoogleLogin auth="authorization_token"

The standard metafile requests all cards associated with the associated user ID

GET http://maps.google.com/maps/feeds/maps/userID/full
Authorization: GoogleLogin auth="authorization_token"

, GET HTTP- , AuthSub GoogleLogin, . ( GoogleLogin ClientLogin.)


, HTTP- HTTP-. authorization_token, :

# coding: utf-8

import urllib, re, getpass

# http://code.google.com/intl/pt-BR/apis/maps/documentation/mapsdata/developers_guide_protocol.html#ClientLogin

username = 'heltonbiker'
senha = getpass.getpass('Senha do usuário ' + username + ':')

dic = {
        'accountType':      'GOOGLE',
        'Email':            (username + '@gmail.com'),
        'Passwd':           senha,
        'service':          'local',
        'source':           'helton-mapper-1'
        }
url = 'https://www.google.com/accounts/ClientLogin?' + urllib.urlencode(dic)
output = urllib.urlopen(url).read()
authid = output.strip().split('\n')[-1].split('=')[-1]

httplib docs, ( ).

?

+5
1

urllib2 :

import urllib2

request = urllib2.Request('http://maps.google.com/maps/feeds/maps/default/full')
request.add_header('Authorization', 'GoogleLogin auth=%s' % authorization_token)
urllib2.urlopen(request).read()

, API Google Maps ? http://googlegeodevelopers.blogspot.com/2010/11/maps-data-api-deprecation-announcement.html

+7

All Articles