소스 검색

Added header and kwarg functionality to get_page function.

tags/v1.8.0
Roxie Gibson 6 년 전
부모
커밋
64905f3adc
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. +2
    -2
      roxbot/http.py

+ 2
- 2
roxbot/http.py 파일 보기

@@ -88,12 +88,12 @@ async def upload_file(url, file):
return await resp.json()


async def get_page(url):
async def get_page(url, *, headers=None, **kwargs):
"""
Returns the page at the given url
:param url: the url of the page you want to get
:return: the html page
"""
async with aiohttp.ClientSession() as session:
async with session.get(url, headers={'User-agent': 'RoxBot Discord Bot'}) as page:
async with session.get(url, headers=headers, **kwargs) as page:
return await page.text()

Loading…
취소
저장