-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to choose different subreddit #63
Comments
Fix Reason: on windows systems the config.ini import is pulling in the CRLF and header useragents don't like that replace this line with |
Authentication is also broken on Windows for Reddit API + using the Config.ini Fix: `reddit_client_id = "CLIENT_ID" reddit_client_secret = "CLIENT_SECRET" reddit_client_password = "ACCOUNT_PASSWORD" reddit_client_username = "ACCOUNT_USERNAME" reddit_client_user_agent = "RedditDATA" reddit = praw.Reddit(client_id=reddit_client_id, |
Suggestion movie all config.ini files into json file instead... would remove the CRLF issue for windows machines. |
hi bro |
When selecting a subreddit other than "AskReddit" the following error occurs
Note: AskReddit works just fine, only happens if you change the subreddit in initserver.py
`Found config.ini
Started database connection
Starting server on localhost port 10000
Server wait client thread started
Starting video generator server on localhost port 11000
Server Video Generator wait client thread started
Grabbing more scripts...
Exception in thread Thread-5:
Traceback (most recent call last):
File "C:\Python38\lib\site-packages\prawcore\requestor.py", line 54, in request
return self._http.request(*args, timeout=timeout, **kwargs)
File "C:\Python38\lib\site-packages\requests\sessions.py", line 516, in request
prep = self.prepare_request(req)
File "C:\Python38\lib\site-packages\requests\sessions.py", line 449, in prepare_request
p.prepare(
File "C:\Python38\lib\site-packages\requests\models.py", line 315, in prepare
self.prepare_headers(headers)
File "C:\Python38\lib\site-packages\requests\models.py", line 449, in prepare_headers
check_header_validity(header)
File "C:\Python38\lib\site-packages\requests\utils.py", line 947, in check_header_validity
raise InvalidHeader("Invalid return character or leading space in header: %s" % name)
requests.exceptions.InvalidHeader: Invalid return character or leading space in header: User-Agent
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File ".\initserver.py", line 39, in updateScripts
getScripts()
File ".\initserver.py", line 17, in getScripts
info = reddit.getInfo('ELI5', settings.reddit_amount_posts)
File "D:\00-Coding\Python\youtube_reddit\YouTube Bot Server\reddit.py", line 101, in getInfo
for x, submission in enumerate(hot_subreddit):
File "C:\Python38\lib\site-packages\praw\models\listing\generator.py", line 63, in next
self._next_batch()
File "C:\Python38\lib\site-packages\praw\models\listing\generator.py", line 73, in _next_batch
self._listing = self._reddit.get(self.url, params=self.params)
File "C:\Python38\lib\site-packages\praw\reddit.py", line 566, in get
return self._objectify_request(method="GET", params=params, path=path)
File "C:\Python38\lib\site-packages\praw\reddit.py", line 666, in _objectify_request
self.request(
File "C:\Python38\lib\site-packages\praw\reddit.py", line 848, in request
return self._core.request(
File "C:\Python38\lib\site-packages\prawcore\sessions.py", line 324, in request
return self._request_with_retries(
File "C:\Python38\lib\site-packages\prawcore\sessions.py", line 222, in _request_with_retries
response, saved_exception = self._make_request(
File "C:\Python38\lib\site-packages\prawcore\sessions.py", line 179, in _make_request
response = self._rate_limiter.call(
File "C:\Python38\lib\site-packages\prawcore\rate_limit.py", line 33, in call
kwargs["headers"] = set_header_callback()
File "C:\Python38\lib\site-packages\prawcore\sessions.py", line 277, in _set_header_callback
self._authorizer.refresh()
File "C:\Python38\lib\site-packages\prawcore\auth.py", line 305, in refresh
self._request_token(grant_type=grant_type, device_id=self._device_id)
File "C:\Python38\lib\site-packages\prawcore\auth.py", line 155, in _request_token
response = self._authenticator._post(url, **data)
File "C:\Python38\lib\site-packages\prawcore\auth.py", line 30, in _post
response = self._requestor.request(
File "C:\Python38\lib\site-packages\prawcore\requestor.py", line 56, in request
raise RequestException(exc, args, kwargs)
prawcore.exceptions.RequestException: error with request Invalid return character or leading space in header: User-Agent`
The text was updated successfully, but these errors were encountered: