在我的应用程序中,我有一个注册产品列表。
我正在尝试在 url 中发送产品名称。
但是,它具有#标签的产品名称和产品名称到达服务器时不完整:
前端
var product = "PLASTIC #1JQ-M 1CV T-PLAS"
return this._http.get(Config.URL_SITE + 'list/productLen?product='+product)...
Run Code Online (Sandbox Code Playgroud)
后端
router.get('/productLen', function(req, res, next) {
var productName= req.query.product;
console.log(productName) //PLASTIC
...
Run Code Online (Sandbox Code Playgroud)
如何让productName变量接收全名?
"PLASTIC #1JQ-M 1CV T-PLAS"
我需要能够获得页面的完整URL页面URL是这样的
http://localhost:12365/Dashboard.aspx#access_token=adfgafdg73e9c4ggg186fbfcf05e775a6f2gggd8&expires_in=3600&token_type=Bearer&state=zxv
Run Code Online (Sandbox Code Playgroud)
在这个URL中,#在如何获取access_token值之后?
我正在使用请求来编译自定义 URL,并且一个参数包含一个井号。谁能解释如何在不编码井号的情况下传递参数?
这将返回正确的 CSV 文件
results_url = 'https://baseballsavant.mlb.com/statcast_search/csv?all=true&hfPT=&hfAB=&hfBBT=&hfPR=&hfZ=&stadium=&hfBBL=&hfNewZones=&hfGT=R%7C&hfC=&hfSea=2019%7C&hfSit=&player_type=batter&hfOuts=&opponent=&pitcher_throws=&batter_stands=&hfSA=&game_date_gt=&game_date_lt=&hfInfield=&team=&position=&hfOutfield=&hfRO=&home_road=&hfFlag=&hfPull=&metric_1=&hfInn=&min_pitches=0&min_results=0&group_by=name&sort_col=pitches&player_event_sort=h_launch_speed&sort_order=desc&min_abs=0&type=#results'
results = requests.get(results_url, timeout=30).content
results_df = pd.read_csv(io.StringIO(results.decode('utf-8')))
Run Code Online (Sandbox Code Playgroud)
这不
URL = 'https://baseballsavant.mlb.com/statcast_search/csv?'
def _get_statcast(params):
_get = get(URL, params=params, timeout=30)
_get.raise_for_status()
return _get.content
Run Code Online (Sandbox Code Playgroud)
问题似乎是,当通过请求传递 '#results' 时,'#' 被忽略后会导致下载错误的 CSV。如果有人对解决此问题的其他方式有任何想法,我将不胜感激。
EDIT2:也在python论坛上问过这个https://python-forum.io/Thread-Handling-pound-sign-within-custom-URL?pid=75946#pid75946
我使用Request.QueryString ["var"]将http://test.com/test.aspx?var=test的值拉入字符串
同样的事情不适用于test.aspx#var = test
如何从该版本的查询字符串中获取它?
可能重复:
如何从服务器端获取Url Hash(#)
我在url中有哈希参数
任何正文可以帮助我如何使用C#从Url读取哈希参数值?
www.example.com/default.aspx#!type=1
Run Code Online (Sandbox Code Playgroud)
如何读取价值type?