MCPcopy Create free account
hub / github.com/ActiveState/code / post_cookbook

Function post_cookbook

recipes/Python/576439_Post_automatically/recipe-576439.py:11–22  ·  view source on GitHub ↗
(login,password,title,description,tags,code,discussion)

Source from the content-addressed store, hash-verified

9"""
10
11def post_cookbook(login,password,title,description,tags,code,discussion):
12 http = httplib2.Http()
13 url = 'http://login.activestate.com/signin/?next=http%3A%2F%2Fcode.activestate.com%2Frecipes%2Flangs%2Fpython%2F'
14 body = {'email': login, 'password': password}
15 headers = {'Content-type': 'application/x-www-form-urlencoded'}
16 response, content = http.request(url, 'POST', headers=headers, body=urllib.urlencode(body))
17
18 headers = {'Cookie': response['set-cookie'],'Content-type': 'application/x-www-form-urlencoded'}
19 #lang : 1 is for python langage
20 body = {'title': title, 'description': description,'tags':tags,'lang':1,'code' : code,'discussion':discussion}
21 url = 'http://code.activestate.com/recipes/add/'
22 response, content = http.request(url, 'POST', headers=headers,body=urllib.urlencode(body))
23
24
25if __name__ == "__main__":

Callers 1

recipe-576439.pyFile · 0.85

Calls 1

requestMethod · 0.45

Tested by

no test coverage detected