name error?
API request stopped working, can someone help?
Stack trace? Also is this using Django, Flask? From where are you calling this?
Just from a copy of Python on my laptop. Python 3.7 32-bit if that helps?

This is so rude!
archives = archives.replace("{\"archives\":[\"", "\",\"")
archivesList = archives.split("\",\"" + baseUrl)
archivesList[len(archivesList)-1] = archivesList[len(archivesList)-1].rstrip("\"]}")
You are working with the endpoint like with a string, but have you ever heard that API returns JSON? Using JSON module, you can easily convert response into Python classic types. Check it here ( https://docs.python.org/3.5/library/json.html ).
And many other things that make shivers run over the skin... Nevertheless, the answer on your question: with this code you should always use username lower-cased. I. e. username = "bobchess" etc.
Did you copy this code from somewhere?
I used the code below to pull my games archives but it stopped working recently. I'm not very literate so I can't tell whether it's something with the Python library or the chess.com API. This is part of the error message I get:
Traceback (most recent call last):
File "C:/Users/Bob/Desktop/chess.py", line 9, in <module>
f = urllib.request.urlopen(archivesUrl)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python37-32\lib\urllib\request.py", line 222, in urlopen
return opener.open(url, data, timeout)
Here is the code I was using:
import urllib
import urllib.request
username = "BobChess" #change
baseUrl = "https://api.chess.com/pub/player/" + username + "/games/"
archivesUrl = baseUrl + "archives"
#read the archives url and store in a list
f = urllib.request.urlopen(archivesUrl)
archives = f.read().decode("utf-8")
archives = archives.replace("{\"archives\":[\"", "\",\"")
archivesList = archives.split("\",\"" + baseUrl)
archivesList[len(archivesList)-1] = archivesList[len(archivesList)-1].rstrip("\"]}")
#download all the archives
#indent all lines below except first and last ones
for i in range(len(archivesList)-1):
url = baseUrl + archivesList[i+1] + "/pgn"
filename = archivesList[i+1].replace("/", "-")
urllib.request.urlretrieve(url, "C:/Users/Bob/Desktop/Chess/" + filename + ".pgn") #change
print(filename + ".pgn has been downloaded.")
print ("All files have been downloaded.")