[英]How can I send raw post data with python?
我正在嘗試使用python將數據發布到網頁上。 Facebook上有一個游戲,邀請代碼是5個字母的組合。 我寫了一個腳本,將所有字母組合都寫到txt文件中。
這是我需要發布的數據。 http://pastie.org/2409481
這個cookie'bbbbb'最終將是一個變量,並將循環所有5個字母的可能組合。 [code] invite_code%5D = bbbbb [/ code]
看一下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
設置任何內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.