如何使用python发送原始帖子数据?

时间:2011-08-22 03:15:56

标签: python variables http-headers http-post brute-force

我正在尝试使用python将数据发布到网页。 Facebook上有一个游戏,邀请码是5个字母的组合。 我编写了一个脚本,将所有字母组合写入txt文件。

以下是我需要发布的数据。 http://pastie.org/2409481

这个cookie'bbbbb'将最终成为一个变量,并将遍历5个字母的所有可能组合。 [代码] invite_code%5D = BBBBB [/代码]

1 个答案:

答案 0 :(得分:0)

看一下Requests,urllib2的包装器(我相信)。从该页面中删除其中一个示例:

# This example cooked up by me!

import requests
post_data = {"amount":10000, "service":"writing blog posts"}

r = requests.post('http://example.com/api', post_data, auth=('user', 'pass'))

print r.status_code
print r.headers['content-type']

# ------
# 200
# 'application/json'

您应该可以为post_data设置任何内容。

相关问题