urllib2

    0熱度

    1回答

    我正在爲包含數學常量的網頁開發Web解析器。我需要替換一些字符才能使其具有特定格式,但我不知道爲什麼如果我打印它,我似乎工作正常;但是當我打開輸出文件時,replace()所實現的格式似乎不起作用。 這是代碼 #!/usr/bin/env python3 from urllib.request import urlopen from bs4 import BeautifulSoup ur

    0熱度

    1回答

    我一直在Python代碼中搜索並從NSIDC https網站下載SMAP衛星數據。我的代碼是工作,直到上週開始時的缺陷: urllib2.HTTPError: HTTP Error 404: Not Found 任何幫助嗎? 該代碼是從一個NSIDC網站提出的改編,以完成我所需要的。下面的例子: """This script, NSIDC_parse_HTML_BatchDL.py, define

    0熱度

    2回答

    我需要一個幫助。我需要從遠程源下載文件並使用Python將其存儲到本地文件夾中。我在下面解釋我的代碼。 def downloadfile(request): """ This function helps to download the file from remote site""" if request.method == 'POST': URL = requ

    1熱度

    2回答

    我在aws-lambda中寫了一個函數。該功能很簡單。它只是從特定網站獲取請求。 python2中的Lambda函數如下所示。也包括import urllib2。 def lambda_handler(event, context): # TODO implement url = "https://www.amazon.co.jp/s/field-keywords=454896

    0熱度

    2回答

    我目前有一個cURL命令可以在我的環境中使用。我需要將其轉換成一個Python 2.7的urllib等同,需要一些幫助 cURL命令中的問題: curl -k -v -XPOST -H "Authorization: Bearer $Token" -F [email protected]${local_filename} https://interesting_url.com/ 我需要同時支持

    0熱度

    1回答

    當我跑步到TypeError: a float is required當我嘗試創建一個使用websocket.create_connection full_url = "wss://myurl:443/abc/def/ghi?id=asdf3nnasdfj34nasdf23" header_conn = dict() header_conn['Authorization'] = "Auth s

    0熱度

    1回答

    我想在cmd控制檯中安裝urllib2從python 3.5導入它。 我收到此錯誤: pip install urllib2 Failed building wheel for urllib2 Command "c:\anaconda\python.exe -u -c "import setuptools, tokenize;file='C:\Users\NA401134\AppData\Lo

    0熱度

    1回答

    我想從NSE印度網站下載數據。要下載的數據是我下載後處理的zip文件。 其下載的日期的文件,一年後2016年 def start_download(): directory = 'data' hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.11 (KHTML, like Gecko)

    0熱度

    1回答

    我在python中寫了一個簡單的爬蟲。它似乎工作正常,並找到新的鏈接,但重複發現相同的鏈接,而不是下載找到的新網頁。它似乎即使在達到設定的爬行深度限制後也會無限爬行。我沒有收到任何錯誤。它只是永遠運行。這是代碼和運行。我在Windows 7 64位上使用Python 2.7。 import sys import time from bs4 import * import urllib2 i

    1熱度

    1回答

    我有一個簡單的Python腳本,它應該從HTTP源讀取文件並向另一個HTTP源發出PUT請求。 block_size = 4096 file = urllib2.urlopen('http://path/to/someting.file').read(block_size) headers = {'X-Auth-Token': token_id, 'content-type': 'appli