Code: Select all
import requests
r = requests.get('hhttps://dbr.ee/aUJA/d?', allow_redirects=False, headers={'User-Agent': 'Mozilla/5.0'})
print r.headers
{'Status': '302 Found', 'X-Request-Id':
'9e968067-1bee-4cc9-9305-19d45d5cb6ea', 'X-XSS-Protection': '1;
mode=block', 'X-Content-Type-Options': 'nosniff', 'Transfer-Encoding':
'chunked', 'Set-Cookie':
'__cfduid=d21c538fd46c153a046bf461ca281978d1499637583; läuft ab=Mo,
09.07.18 21:59:43 GMT; path=/; domain=.dbr.ee; HttpOnly,
ahoy_visitor=f4f1c08c-add3-45c0-8325-675b1caf3048; path=/;
expires=Di, 09. Juli 2019 21:59:44 -0000,
ahoy_visit=cdbb4ca8-3272-473c-8562-03596d88ec0f; path=/; läuft ab=Mo,
10. Juli 2017 01:59:44 -0000, ahoy_track=true; path=/, SERVERID=;
Expires=Do, 01.01.1970 00:00:01 GMT; path=/', 'X-Runtime':
'0.006820', 'Server': 'cloudflare-nginx', 'Connection': 'keep-alive',
'Location': 'hhttps://dbr.ee/aUJA', 'Cache-Control': 'no-cache',
'Date': 'Sun, 09. Juli 2017 21:59:44 GMT', 'X-Frame-Options':
'SAMEORIGIN', 'Content-Type': 'text/html; charset=utf-8', 'CF-RAY':
'37be8d52fdc83822-ATL'
Das ist:
'Location': 'hhttps://dbr.ee/aUJA'
Auf der Website ist der eigentliche Antwortheader dieser (über Chrome Developer Tools angezeigt)
cache-control:no-cache cf-ray:37be8bacacb437d4-ATL
content-type:text/html; charset=utf-8 Datum:Sonntag, 09.07.2017 21:58:36
GMT
location:hhttps://s.dbr.ee/sffc/python%2Dlogo%2Dmaster%2Dv3%2DTM.png.zip?temp_url_sig=41ebabb749293a6fe3 f3ec82c5ab8ec01b0ed053&temp_url_expires=1499637816&filename=python-logo-master-v3-TM.png.zip;&attachment
server:cloudflare-nginx
set-cookie:ahoy_visit=f7d15e42-155c-443f-a637-22c3681863a5; path=/;
expires=Mo, 10. Juli 2017 01:58:36 -0000
set-cookie:_dbree_session=U2x6akdCbUJ4c28wdW9MeUFYOXo1QUVxLzV3ZVNxcGtTWW1jbVd kWEdPOWZPMWFiOEl4M0VWY1dOWGNYTjNubEJoVWJHejRCTlQwQlkwL0UrM09QallTMzhFZlU3RFBBTDZ xaW9xcGRMeXNlQS9mZFByYTZQWTM0ZlBHMU50ekhhTkt1bjZENXJHRnc2a3dWeGY2d3BBPT0tLVNKOT JnL0Q3SjloWEc0MTZqTnRPNFE9PQ%3D%3D--2dd8f3e77a673f385c9a231af426b55f1d1f71c0;
domain=dbr.ee; path=/; HttpOnly set-cookie:SERVERID=; Läuft ab=Do,
01.01.1970 00:00:01 GMT; path=/ Status:302 Status:302 Gefunden
x-content-type-options:nosniff mode=block
wobei Standort ist
location:hhttps://s.dbr.ee/sffc/python%2Dlogo%2Dmaster%2Dv3%2DTM.png.zip?temp_url_sig=41ebabb749293a6fe3f 3ec82c5ab8ec01b0ed053&temp_url_expires=1499637816&filename=python-logo-master-v3-TM.png.zip;&attachment
Das ist der Download-Link, den ich in Python durchsuchen möchte. Dies wird in den Entwicklertools angezeigt, nachdem ich auf die Schaltfläche „Direkter Download“ geklickt habe.
Wie kann ich in der Kopfzeile die korrekte Feldposition in Python anzeigen?
*Links wurden mit „h“ vor „http“ geändert, da ich nicht mehr als zwei Links posten kann, sie sind jedoch für den Kontext der Frage erforderlich
Mobile version