René's URL Explorer Experiment


Title: 'NoneType' object is not subscriptable · Issue #33 · ma2za/python-substack · GitHub

Open Graph Title: 'NoneType' object is not subscriptable · Issue #33 · ma2za/python-substack

X Title: 'NoneType' object is not subscriptable · Issue #33 · ma2za/python-substack

Description: Error From 2025-10-24, I've noticed I was getting the following error: [i] Logging into Substack... DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): substack.com:443 DEBUG:urllib3.connectionpool:https://substack.com:443 "G...

Open Graph Description: Error From 2025-10-24, I've noticed I was getting the following error: [i] Logging into Substack... DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): substack.com:443 DEBUG:urllib3.co...

X Description: Error From 2025-10-24, I've noticed I was getting the following error: [i] Logging into Substack... DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): substack.com:443 DEBUG:urllib...

Opengraph URL: https://github.com/ma2za/python-substack/issues/33

X: @github

direct link

Domain: patch-diff.githubusercontent.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"'NoneType' object is not subscriptable","articleBody":"## Error\n\nFrom 2025-10-24, I've noticed I was getting the following error:\n\n```shell\n[i] Logging into Substack...\nDEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): substack.com:443\nDEBUG:urllib3.connectionpool:https://substack.com:443 \"GET /api/v1/user/profile/self HTTP/1.1\" 200 None\n[-] An unexpected error occurred: 'NoneType' object is not subscriptable\n```\n\n## Code\n\nThis is my code which is in use:\n\n```python\nprint(\"[i] Logging into Substack...\")\ntry:\n    api = Api(\n        debug=logging.getLogger().isEnabledFor(logging.DEBUG),\n        publication_url=os.getenv(\"PUBLICATION_URL\"),\n        cookies_path=cookie,\n        email=email,\n        password=password\n    )\n    print(\"[+] Logged into Substack!\")\nexcept Exception as e:\n    print(f\"[-] An unexpected error occurred: {e}\")\n    sys.exit(1)\n```\n\n## API (Today)\n\nDigging into the API response as of today (2025-12-18):\n\n```console\n$ curl \\\n    --silent \\\n    --header 'Cookie: substack.sid=[REMOVED]' \\\n   'https://substack.com/api/v1/user/profile/self' \\\n  | jq '.. | objects | keys'\n[\n  \"bio\",\n  \"can_dm\",\n  \"facebookAccount\",\n  \"followerCount\",\n  \"followsViewer\",\n  \"handle\",\n  \"hasActivity\",\n  \"hasGuestPost\",\n  \"hasHiddenPublicationUsers\",\n  \"hasHiddenSubscriptions\",\n  \"hasLikes\",\n  \"id\",\n  \"isFollowing\",\n  \"isSubscribed\",\n  \"lists\",\n  \"max_pub_tier\",\n  \"name\",\n  \"photo_url\",\n  \"previousSlug\",\n  \"previous_name\",\n  \"primaryPublicationSubscriptionState\",\n  \"profile_disabled\",\n  \"profile_set_up_at\",\n  \"publicationUsers\",\n  \"reader_installed_at\",\n  \"slug\",\n  \"status\",\n  \"subscriberCount\",\n  \"subscriberCountNumber\",\n  \"subscriberCountString\",\n  \"subscribesToViewerSubdomain\",\n  \"subscriptions\",\n  \"subscriptionsTruncated\",\n  \"theme\",\n  \"tos_accepted_at\",\n  \"twitterAccount\",\n  \"userLinks\",\n  \"visibleSubscriptionsCount\"\n]\n[\n  \"id\",\n  \"label\",\n  \"type\",\n  \"url\",\n  \"value\"\n]\n[\n  \"id\",\n  \"label\",\n  \"type\",\n  \"url\",\n  \"value\"\n]\n[\n  \"id\",\n  \"label\",\n  \"type\",\n  \"url\",\n  \"value\"\n]\n[]\n[\n  \"badge\",\n  \"bestsellerTier\",\n  \"leaderboard\",\n  \"paidPublicationIds\",\n  \"subscriber\",\n  \"subscriberTier\",\n  \"vip\"\n]\n$\n```\n\n## API (Previously)\n\nLooking at [NHagar/substack_ap](https://github.com/NHagar/substack_api/blob/master/examples/usage_walkthrough.ipynb) ([WayBackMachine](https://web.archive.org/web/20251218122222/https://github.com/NHagar/substack_api/blob/master/examples/usage_walkthrough.ipynb)), was able to see a able to see the historical version of the API response:\n\n```console\n$ cat /tmp/usage_walkthrough.json | jq 'keys'\n[\n  \"bestseller_badge_disabled\",\n  \"bestseller_tier\",\n  \"bio\",\n  \"followsViewer\",\n  \"handle\",\n  \"hasActivity\",\n  \"hasGuestPost\",\n  \"hasHiddenPublicationUsers\",\n  \"hasLikes\",\n  \"id\",\n  \"isFollowing\",\n  \"isPersonalEligible\",\n  \"isSubscribed\",\n  \"lists\",\n  \"max_pub_tier\",\n  \"name\",\n  \"photo_url\",\n  \"previousSlug\",\n  \"previous_name\",\n  \"primaryPublication\",\n  \"profile_disabled\",\n  \"profile_set_up_at\",\n  \"publicationUsers\",\n  \"rough_num_free_subscribers\",\n  \"rough_num_free_subscribers_int\",\n  \"slug\",\n  \"subdomainUrl\",\n  \"subscriberCount\",\n  \"subscriberCountNumber\",\n  \"subscriberCountString\",\n  \"subscriptions\",\n  \"subscriptionsTruncated\",\n  \"tos_accepted_at\",\n  \"userLinks\",\n  \"visibleSubscriptionsCount\"\n]\n$\n```\n\nConverted JSON: [usage_walkthrough.json](https://github.com/user-attachments/files/24237139/usage_walkthrough.json)\n\n## Compare APIs\n\n```console\n$ cat /tmp/usage_walkthrough.json| jq 'keys' \u003e usage_walkthrough-keys\n$ \n$ curl \\\n    --silent \\\n    --header 'Cookie: substack.sid=[REMOVED]' \\\n   'https://substack.com/api/v1/user/profile/self' | jq 'key \u003e self-keys\n$ \n$ diff self-keys usage_walkthrough-keys\n1a2,3\n\u003e   \"bestseller_badge_disabled\",\n\u003e   \"bestseller_tier\",\n3,5d4\n\u003c   \"can_dm\",\n\u003c   \"facebookAccount\",\n\u003c   \"followerCount\",\n11d9\n\u003c   \"hasHiddenSubscriptions\",\n14a13\n\u003e   \"isPersonalEligible\",\n22c21\n\u003c   \"primaryPublicationSubscriptionState\",\n---\n\u003e   \"primaryPublication\",\n26c25,26\n\u003c   \"reader_installed_at\",\n---\n\u003e   \"rough_num_free_subscribers\",\n\u003e   \"rough_num_free_subscribers_int\",\n28c28\n\u003c   \"status\",\n---\n\u003e   \"subdomainUrl\",\n32d31\n\u003c   \"subscribesToViewerSubdomain\",\n35d33\n\u003c   \"theme\",\n37d34\n\u003c   \"twitterAccount\",\n$\n```\n\n## Following the error\n\nLooking for `/api/v1/user/profile/self`:\n\n```console\n$ git clone https://github.com/ma2za/python-substack\n[...]\n$\n$ cd ./python-substack/\n$\n$ grep -Rn '/api/v1/user/profile/self'\n$\n$ grep -Rn '/self'\n./substack/api.py:234:        response = self._session.get(f\"{self.base_url}/user/profile/self\")\n$\n$ grep -Rn -C 5 '/self'\n./substack/api.py-229-\n./substack/api.py-230-    def get_user_profile(self):\n./substack/api.py-231-        \"\"\"\n./substack/api.py-232-        Gets the users profile\n./substack/api.py-233-        \"\"\"\n./substack/api.py:234:        response = self._session.get(f\"{self.base_url}/user/profile/self\")\n./substack/api.py-235-\n./substack/api.py-236-        return Api._handle_response(response=response)\n./substack/api.py-237-\n./substack/api.py-238-    def get_user_settings(self):\n./substack/api.py-239-        \"\"\"\n```\n\nCan see that `./substack/api.py` has `get_user_profile()`.\n\n- - - \n\n```console\n$ grep -n get_user_profile ./substack/api.py | wc -l\n       4\n$\n$ grep -n get_user_profile ./substack/api.py\n179:        profile = self.get_user_profile()\n205:        profile = self.get_user_profile()\n218:        profile = self.get_user_profile()\n230:    def get_user_profile(self):\n$\n```\n\nAnd its only used called in 3 places.\n\n```console\n$ grep -nB 6 self.get_user_profile ./substack/api.py\n173-    def get_user_id(self):\n174-        \"\"\"\n175-\n176-        Returns:\n177-\n178-        \"\"\"\n179:        profile = self.get_user_profile()\n--\n199-\n200-    def get_user_primary_publication(self):\n201-        \"\"\"\n202-        Gets the users primary publication\n203-        \"\"\"\n204-\n205:        profile = self.get_user_profile()\n--\n212-\n213-    def get_user_publications(self):\n214-        \"\"\"\n215-        Gets the users publications\n216-        \"\"\"\n217-\n218:        profile = self.get_user_profile()\n$ \n```\n\n- `get_user_id()`\n- `get_user_primary_publication()`\n- `get_user_publications()`\n\n### get_user_id()\n\n```console\n$ grep get_user_id ./substack/api.py\n    def get_user_id(self):\n$\n```\n\n...As our code doesn't use `get_user_id`, its not going to be this\n\n### get_user_primary_publication() / get_user_publications()\n\n```console\n$ grep self.get_user_primary_publication ./substack/api.py\n            user_publication = self.get_user_primary_publication()\n$ \n$ grep self.get_user_publications ./substack/api.py\n            user_publications = self.get_user_publications()\n$ \n```\n\nSo let's see where these are being called:\n\n```python\nclass Api:\n[...]\n    def __init__(\n[...]\n        # if the user provided a publication url, then use that\n        if publication_url:\n[...]\n            user_publications = self.get_user_publications()\n[...]\n        else:\n            # get the users primary publication\n            user_publication = self.get_user_primary_publication()\n```\n\nBingo! This starts to match up whats in the code (right at the top)\nSo using `Api()`, if `publication_url` is set, `get_user_publications()` is called, Otherwise its `get_user_primary_publication()`\n_For what its worth, `publication_url` is set for me_\n\n### get_user_publications()\n\nLooking at the function:\n\n```python\n    def get_user_publications(self):\n        \"\"\"\n        Gets the users publications\n        \"\"\"\n\n        profile = self.get_user_profile()\n\n        # Loop through users \"publicationUsers\" list, and return a list\n        # of dictionaries of \"name\", and \"subdomain\", and \"id\"\n        user_publications = []\n        for publication in profile[\"publicationUsers\"]:\n[...]\n```\n\nIts expecting `publicationUsers` in the API response back....\n**It USED to be there, but its not anymore!**\n\n### get_user_primary_publication()\n\nLooking at the function:\n\n```python\n    def get_user_primary_publication(self):\n        \"\"\"\n        Gets the users primary publication\n        \"\"\"\n\n        profile = self.get_user_profile()\n        primary_publication = profile[\"primaryPublication\"]\n[...]\n```\n\nIts expecting `primaryPublication` in the API response back....\n**Again It USED to be there, but its not anymore!**\n\nThis may start to explain why its failing....\n","author":{"url":"https://github.com/g0tmi1k","@type":"Person","name":"g0tmi1k"},"datePublished":"2025-12-18T14:28:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/33/python-substack/issues/33"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:671551b6-9498-f5c3-a964-b11623b1fc83
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idEBEE:7AF86:2057078:2AD8956:698D895D
html-safe-nonce90139c11f697e73ad25f37e7a94f41561bf957ac85069d6eb6e508e4a4023662
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkVFOjdBRjg2OjIwNTcwNzg6MkFEODk1Njo2OThEODk1RCIsInZpc2l0b3JfaWQiOiI4ODcwNTc3NzIxMjE1NjUwMTQxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacde54e41f9b6c86b2d647aa88417f36422f5c36f278c77712b6d3d1a61b3e4bdb
hovercard-subject-tagissue:3743400644
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ma2za/python-substack/33/issue_layout
twitter:imagehttps://opengraph.githubassets.com/54c093bea4ca44b26e09af0cd47db4ad3027de76c3c3dfe1275039f3d0ae0150/ma2za/python-substack/issues/33
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/54c093bea4ca44b26e09af0cd47db4ad3027de76c3c3dfe1275039f3d0ae0150/ma2za/python-substack/issues/33
og:image:altError From 2025-10-24, I've noticed I was getting the following error: [i] Logging into Substack... DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): substack.com:443 DEBUG:urllib3.co...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameg0tmi1k
hostnamegithub.com
expected-hostnamegithub.com
Nonec0818105fa276287e9369cfdefa0a0fa7953719791ceff9b94d69623c0a4fe8a
turbo-cache-controlno-preview
go-importgithub.com/ma2za/python-substack git https://github.com/ma2za/python-substack.git
octolytics-dimension-user_id59370937
octolytics-dimension-user_loginma2za
octolytics-dimension-repository_id507708304
octolytics-dimension-repository_nwoma2za/python-substack
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id507708304
octolytics-dimension-repository_network_root_nwoma2za/python-substack
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4c8f4bd0b67d7f1472d0ab3f49827eaae062a36b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://patch-diff.githubusercontent.com/ma2za/python-substack/issues/33#start-of-content
https://patch-diff.githubusercontent.com/
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fma2za%2Fpython-substack%2Fissues%2F33
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://patch-diff.githubusercontent.com/login?return_to=https%3A%2F%2Fgithub.com%2Fma2za%2Fpython-substack%2Fissues%2F33
Sign up https://patch-diff.githubusercontent.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=ma2za%2Fpython-substack
Reloadhttps://patch-diff.githubusercontent.com/ma2za/python-substack/issues/33
Reloadhttps://patch-diff.githubusercontent.com/ma2za/python-substack/issues/33
Reloadhttps://patch-diff.githubusercontent.com/ma2za/python-substack/issues/33
ma2za https://patch-diff.githubusercontent.com/ma2za
python-substackhttps://patch-diff.githubusercontent.com/ma2za/python-substack
Notifications https://patch-diff.githubusercontent.com/login?return_to=%2Fma2za%2Fpython-substack
Fork 21 https://patch-diff.githubusercontent.com/login?return_to=%2Fma2za%2Fpython-substack
Star 136 https://patch-diff.githubusercontent.com/login?return_to=%2Fma2za%2Fpython-substack
Code https://patch-diff.githubusercontent.com/ma2za/python-substack
Issues 5 https://patch-diff.githubusercontent.com/ma2za/python-substack/issues
Pull requests 0 https://patch-diff.githubusercontent.com/ma2za/python-substack/pulls
Actions https://patch-diff.githubusercontent.com/ma2za/python-substack/actions
Projects 0 https://patch-diff.githubusercontent.com/ma2za/python-substack/projects
Security 0 https://patch-diff.githubusercontent.com/ma2za/python-substack/security
Insights https://patch-diff.githubusercontent.com/ma2za/python-substack/pulse
Code https://patch-diff.githubusercontent.com/ma2za/python-substack
Issues https://patch-diff.githubusercontent.com/ma2za/python-substack/issues
Pull requests https://patch-diff.githubusercontent.com/ma2za/python-substack/pulls
Actions https://patch-diff.githubusercontent.com/ma2za/python-substack/actions
Projects https://patch-diff.githubusercontent.com/ma2za/python-substack/projects
Security https://patch-diff.githubusercontent.com/ma2za/python-substack/security
Insights https://patch-diff.githubusercontent.com/ma2za/python-substack/pulse
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/ma2za/python-substack/issues/33
New issuehttps://patch-diff.githubusercontent.com/login?return_to=https://github.com/ma2za/python-substack/issues/33
'NoneType' object is not subscriptablehttps://patch-diff.githubusercontent.com/ma2za/python-substack/issues/33#top
https://github.com/g0tmi1k
https://github.com/g0tmi1k
g0tmi1khttps://github.com/g0tmi1k
on Dec 18, 2025https://github.com/ma2za/python-substack/issues/33#issue-3743400644
NHagar/substack_aphttps://github.com/NHagar/substack_api/blob/master/examples/usage_walkthrough.ipynb
WayBackMachinehttps://web.archive.org/web/20251218122222/https://github.com/NHagar/substack_api/blob/master/examples/usage_walkthrough.ipynb
usage_walkthrough.jsonhttps://github.com/user-attachments/files/24237139/usage_walkthrough.json
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.