我对Python非常陌生,这实际上是我的第一个应用程序,所以请容忍我。我想去一个特定的网站,填写表格中的信息,然后在POST
填完表格后得到任何信息。有人能帮我一下吗。先谢谢你。你知道吗
import requests
import mechanize
from bs4 import BeautifulSoup
# set needed variables
br = mechanize.Browser()
url = 'https://www.oanda.com/currency/average'
startMonth = input('Enter Month Number: ')
endMonth = startMonth
year = input('Enter Year: ')
duration = 'Month'
convertAmount = 1
foreignCurrency = 'AED'
domesticCurrency = 'USD'
interBankRate = 0
viewFormat = 'HTML'
payload = { 'amount': convertAmount, 'avg_type': duration,
'start_month': startMonth, 'end_month': endMonth,
'start_year': year, 'end_year': year, 'base': foreignCurrency,
'exchange': domesticCurrency, 'interbank': interBankRate,
'format': viewFormat }
#br.open(url)
#html = br.read()
#print html
# r = requests.get(url)
r = requests.post(url, data=payload)
r.text
print r.text
目前没有回答
相关问题 更多 >
编程相关推荐