Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "tiktoken is a fast BPE tokeniser for use with OpenAI's models"
readme = "README.md"
license = { file = "LICENSE" }
authors = [{ name = "Shantanu Jain" }, { email = "[email protected]" }]
dependencies = ["regex>=2022.1.18", "requests>=2.26.0"]
dependencies = ["regex>=2022.1.18"]
optional-dependencies = { blobfile = ["blobfile>=2"] }
requires-python = ">=3.9"

Expand Down
9 changes: 4 additions & 5 deletions tiktoken/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ def read_file(blobpath: str) -> bytes:
return f.read()

# avoiding blobfile for public files helps avoid auth issues, like MFA prompts
import requests

resp = requests.get(blobpath)
resp.raise_for_status()
return resp.content
import urllib.request
with urllib.request.urlopen(blobpath) as response:
resp = response.read()
return resp


def check_hash(data: bytes, expected_hash: str) -> bool:
Expand Down