socialapihq 0.1.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. socialapihq-0.1.3/.gitattributes +1 -0
  2. socialapihq-0.1.3/.github/workflows/ci.yml +22 -0
  3. socialapihq-0.1.3/.github/workflows/generate.yml +150 -0
  4. socialapihq-0.1.3/.gitignore +10 -0
  5. socialapihq-0.1.3/LICENSE +201 -0
  6. socialapihq-0.1.3/PKG-INFO +243 -0
  7. socialapihq-0.1.3/README.md +214 -0
  8. socialapihq-0.1.3/openapitools.json +7 -0
  9. socialapihq-0.1.3/pyproject.toml +45 -0
  10. socialapihq-0.1.3/scripts/generate.py +76 -0
  11. socialapihq-0.1.3/scripts/generate_api_reference.py +41 -0
  12. socialapihq-0.1.3/scripts/generate_client.py +214 -0
  13. socialapihq-0.1.3/scripts/generate_endpoint_tests.py +53 -0
  14. socialapihq-0.1.3/scripts/spec.py +126 -0
  15. socialapihq-0.1.3/src/socialapihq/__init__.py +259 -0
  16. socialapihq-0.1.3/src/socialapihq/api/__init__.py +9 -0
  17. socialapihq-0.1.3/src/socialapihq/api/account_api.py +284 -0
  18. socialapihq-0.1.3/src/socialapihq/api/facebook_api.py +4087 -0
  19. socialapihq-0.1.3/src/socialapihq/api/instagram_api.py +4642 -0
  20. socialapihq-0.1.3/src/socialapihq/api/threads_api.py +3123 -0
  21. socialapihq-0.1.3/src/socialapihq/api/tik_tok_api.py +7121 -0
  22. socialapihq-0.1.3/src/socialapihq/api_client.py +842 -0
  23. socialapihq-0.1.3/src/socialapihq/api_response.py +21 -0
  24. socialapihq-0.1.3/src/socialapihq/client.py +976 -0
  25. socialapihq-0.1.3/src/socialapihq/configuration.py +654 -0
  26. socialapihq-0.1.3/src/socialapihq/exceptions.py +218 -0
  27. socialapihq-0.1.3/src/socialapihq/models/__init__.py +116 -0
  28. socialapihq-0.1.3/src/socialapihq/models/author.py +108 -0
  29. socialapihq-0.1.3/src/socialapihq/models/credits_body.py +88 -0
  30. socialapihq-0.1.3/src/socialapihq/models/error_body.py +98 -0
  31. socialapihq-0.1.3/src/socialapihq/models/error_code.py +51 -0
  32. socialapihq-0.1.3/src/socialapihq/models/facebook_caption_track.py +97 -0
  33. socialapihq-0.1.3/src/socialapihq/models/facebook_comment.py +139 -0
  34. socialapihq-0.1.3/src/socialapihq/models/facebook_comment_all_of_ext.py +102 -0
  35. socialapihq-0.1.3/src/socialapihq/models/facebook_cue.py +92 -0
  36. socialapihq-0.1.3/src/socialapihq/models/facebook_event.py +164 -0
  37. socialapihq-0.1.3/src/socialapihq/models/facebook_intro_item.py +97 -0
  38. socialapihq-0.1.3/src/socialapihq/models/facebook_listing.py +183 -0
  39. socialapihq-0.1.3/src/socialapihq/models/facebook_post.py +141 -0
  40. socialapihq-0.1.3/src/socialapihq/models/facebook_post_all_of_ext.py +129 -0
  41. socialapihq-0.1.3/src/socialapihq/models/facebook_post_kind.py +39 -0
  42. socialapihq-0.1.3/src/socialapihq/models/facebook_profile.py +167 -0
  43. socialapihq-0.1.3/src/socialapihq/models/facebook_profile_all_of_ext.py +130 -0
  44. socialapihq-0.1.3/src/socialapihq/models/facebook_reaction.py +91 -0
  45. socialapihq-0.1.3/src/socialapihq/models/facebook_seller.py +90 -0
  46. socialapihq-0.1.3/src/socialapihq/models/facebook_transcript.py +110 -0
  47. socialapihq-0.1.3/src/socialapihq/models/instagram_bio_link.py +95 -0
  48. socialapihq-0.1.3/src/socialapihq/models/instagram_comment.py +139 -0
  49. socialapihq-0.1.3/src/socialapihq/models/instagram_comment_all_of_ext.py +88 -0
  50. socialapihq-0.1.3/src/socialapihq/models/instagram_highlight.py +118 -0
  51. socialapihq-0.1.3/src/socialapihq/models/instagram_highlight_all_of_ext.py +93 -0
  52. socialapihq-0.1.3/src/socialapihq/models/instagram_place.py +163 -0
  53. socialapihq-0.1.3/src/socialapihq/models/instagram_place_ref.py +90 -0
  54. socialapihq-0.1.3/src/socialapihq/models/instagram_post.py +141 -0
  55. socialapihq-0.1.3/src/socialapihq/models/instagram_post_all_of_ext.py +126 -0
  56. socialapihq-0.1.3/src/socialapihq/models/instagram_post_kind.py +40 -0
  57. socialapihq-0.1.3/src/socialapihq/models/instagram_profile.py +167 -0
  58. socialapihq-0.1.3/src/socialapihq/models/instagram_profile_all_of_ext.py +123 -0
  59. socialapihq-0.1.3/src/socialapihq/models/instagram_sound.py +136 -0
  60. socialapihq-0.1.3/src/socialapihq/models/instagram_sound_all_of_ext.py +102 -0
  61. socialapihq-0.1.3/src/socialapihq/models/instagram_sound_ref.py +99 -0
  62. socialapihq-0.1.3/src/socialapihq/models/instagram_trend.py +137 -0
  63. socialapihq-0.1.3/src/socialapihq/models/instagram_trend_account.py +107 -0
  64. socialapihq-0.1.3/src/socialapihq/models/item_facebook_event.py +92 -0
  65. socialapihq-0.1.3/src/socialapihq/models/item_facebook_listing.py +92 -0
  66. socialapihq-0.1.3/src/socialapihq/models/item_facebook_post.py +92 -0
  67. socialapihq-0.1.3/src/socialapihq/models/item_facebook_profile.py +92 -0
  68. socialapihq-0.1.3/src/socialapihq/models/item_facebook_transcript.py +92 -0
  69. socialapihq-0.1.3/src/socialapihq/models/item_instagram_place.py +92 -0
  70. socialapihq-0.1.3/src/socialapihq/models/item_instagram_post.py +92 -0
  71. socialapihq-0.1.3/src/socialapihq/models/item_instagram_profile.py +92 -0
  72. socialapihq-0.1.3/src/socialapihq/models/item_instagram_sound.py +92 -0
  73. socialapihq-0.1.3/src/socialapihq/models/item_threads_post.py +92 -0
  74. socialapihq-0.1.3/src/socialapihq/models/item_threads_profile.py +92 -0
  75. socialapihq-0.1.3/src/socialapihq/models/item_tik_tok_hashtag.py +92 -0
  76. socialapihq-0.1.3/src/socialapihq/models/item_tik_tok_live.py +92 -0
  77. socialapihq-0.1.3/src/socialapihq/models/item_tik_tok_post.py +92 -0
  78. socialapihq-0.1.3/src/socialapihq/models/item_tik_tok_profile.py +92 -0
  79. socialapihq-0.1.3/src/socialapihq/models/item_tik_tok_sound.py +92 -0
  80. socialapihq-0.1.3/src/socialapihq/models/item_tik_tok_transcript.py +92 -0
  81. socialapihq-0.1.3/src/socialapihq/models/list_facebook_comment.py +101 -0
  82. socialapihq-0.1.3/src/socialapihq/models/list_facebook_event.py +101 -0
  83. socialapihq-0.1.3/src/socialapihq/models/list_facebook_listing.py +101 -0
  84. socialapihq-0.1.3/src/socialapihq/models/list_facebook_post.py +101 -0
  85. socialapihq-0.1.3/src/socialapihq/models/list_instagram_comment.py +101 -0
  86. socialapihq-0.1.3/src/socialapihq/models/list_instagram_highlight.py +101 -0
  87. socialapihq-0.1.3/src/socialapihq/models/list_instagram_post.py +101 -0
  88. socialapihq-0.1.3/src/socialapihq/models/list_instagram_profile.py +101 -0
  89. socialapihq-0.1.3/src/socialapihq/models/list_instagram_trend.py +101 -0
  90. socialapihq-0.1.3/src/socialapihq/models/list_threads_comment.py +101 -0
  91. socialapihq-0.1.3/src/socialapihq/models/list_threads_post.py +101 -0
  92. socialapihq-0.1.3/src/socialapihq/models/list_threads_profile.py +101 -0
  93. socialapihq-0.1.3/src/socialapihq/models/list_tik_tok_comment.py +101 -0
  94. socialapihq-0.1.3/src/socialapihq/models/list_tik_tok_playlist.py +101 -0
  95. socialapihq-0.1.3/src/socialapihq/models/list_tik_tok_post.py +101 -0
  96. socialapihq-0.1.3/src/socialapihq/models/list_tik_tok_profile.py +101 -0
  97. socialapihq-0.1.3/src/socialapihq/models/media.py +125 -0
  98. socialapihq-0.1.3/src/socialapihq/models/media_kind.py +38 -0
  99. socialapihq-0.1.3/src/socialapihq/models/pagination.py +95 -0
  100. socialapihq-0.1.3/src/socialapihq/models/post_stats.py +129 -0
  101. socialapihq-0.1.3/src/socialapihq/models/threads_comment.py +139 -0
  102. socialapihq-0.1.3/src/socialapihq/models/threads_comment_all_of_ext.py +114 -0
  103. socialapihq-0.1.3/src/socialapihq/models/threads_link_preview.py +102 -0
  104. socialapihq-0.1.3/src/socialapihq/models/threads_post.py +141 -0
  105. socialapihq-0.1.3/src/socialapihq/models/threads_post_all_of_ext.py +175 -0
  106. socialapihq-0.1.3/src/socialapihq/models/threads_post_kind.py +39 -0
  107. socialapihq-0.1.3/src/socialapihq/models/threads_post_ref.py +121 -0
  108. socialapihq-0.1.3/src/socialapihq/models/threads_profile.py +167 -0
  109. socialapihq-0.1.3/src/socialapihq/models/threads_profile_all_of_ext.py +90 -0
  110. socialapihq-0.1.3/src/socialapihq/models/tik_tok_comment.py +139 -0
  111. socialapihq-0.1.3/src/socialapihq/models/tik_tok_comment_all_of_ext.py +97 -0
  112. socialapihq-0.1.3/src/socialapihq/models/tik_tok_cue.py +92 -0
  113. socialapihq-0.1.3/src/socialapihq/models/tik_tok_hashtag.py +120 -0
  114. socialapihq-0.1.3/src/socialapihq/models/tik_tok_hashtag_all_of_ext.py +95 -0
  115. socialapihq-0.1.3/src/socialapihq/models/tik_tok_live.py +142 -0
  116. socialapihq-0.1.3/src/socialapihq/models/tik_tok_live_all_of_ext.py +109 -0
  117. socialapihq-0.1.3/src/socialapihq/models/tik_tok_playlist.py +118 -0
  118. socialapihq-0.1.3/src/socialapihq/models/tik_tok_playlist_all_of_ext.py +93 -0
  119. socialapihq-0.1.3/src/socialapihq/models/tik_tok_post.py +141 -0
  120. socialapihq-0.1.3/src/socialapihq/models/tik_tok_post_all_of_ext.py +155 -0
  121. socialapihq-0.1.3/src/socialapihq/models/tik_tok_profile.py +167 -0
  122. socialapihq-0.1.3/src/socialapihq/models/tik_tok_profile_all_of_ext.py +121 -0
  123. socialapihq-0.1.3/src/socialapihq/models/tik_tok_sound.py +136 -0
  124. socialapihq-0.1.3/src/socialapihq/models/tik_tok_sound_all_of_ext.py +97 -0
  125. socialapihq-0.1.3/src/socialapihq/models/tik_tok_sound_ref.py +99 -0
  126. socialapihq-0.1.3/src/socialapihq/models/tik_tok_subtitle.py +92 -0
  127. socialapihq-0.1.3/src/socialapihq/models/tik_tok_transcript.py +103 -0
  128. socialapihq-0.1.3/src/socialapihq/py.typed +0 -0
  129. socialapihq-0.1.3/src/socialapihq/rest.py +334 -0
  130. socialapihq-0.1.3/tests/stub.py +37 -0
  131. socialapihq-0.1.3/tests/test_client.py +73 -0
  132. socialapihq-0.1.3/tests/test_endpoints.py +82 -0
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,22 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ test:
10
+ name: Test on Python ${{ matrix.python }}
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python: ["3.10", "3.13"]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: actions/setup-python@v5
18
+ with:
19
+ python-version: ${{ matrix.python }}
20
+ - run: pip install -e ".[dev]" build
21
+ - run: pytest
22
+ - run: python -m build
@@ -0,0 +1,150 @@
1
+ name: Regenerate
2
+
3
+ # The API's deploy workflow dispatches `openapi-updated` after each production deploy.
4
+ # The run regenerates the package from the live spec and, when it changed, tests, bumps,
5
+ # commits, publishes to PyPI and releases. No change: it stops after the diff.
6
+ on:
7
+ repository_dispatch:
8
+ types: [openapi-updated]
9
+ workflow_dispatch:
10
+ inputs:
11
+ release:
12
+ description: Release even if the spec did not change (the first release)
13
+ type: boolean
14
+ default: false
15
+
16
+ concurrency:
17
+ group: regenerate-sdk
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ regenerate:
22
+ name: Regenerate, release and publish
23
+ runs-on: ubuntu-latest
24
+ permissions:
25
+ contents: write
26
+ id-token: write # PyPI trusted publishing
27
+ environment: pypi
28
+
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ with:
32
+ ref: main
33
+ fetch-depth: 0
34
+
35
+ - uses: actions/setup-python@v5
36
+ with:
37
+ python-version: "3.13"
38
+
39
+ # OpenAPI Generator runs through its npm wrapper, at the version in openapitools.json.
40
+ - uses: actions/setup-node@v4
41
+ with:
42
+ node-version: 24
43
+
44
+ - uses: actions/setup-java@v4
45
+ with:
46
+ distribution: microsoft
47
+ java-version: 21
48
+
49
+ # The npm wrapper downloads the generator's jar on first use; fetch it up front, with
50
+ # retries, so a slow download does not fail the generation step.
51
+ - name: Fetch OpenAPI Generator
52
+ run: |
53
+ for attempt in 1 2 3; do
54
+ npx --yes @openapitools/openapi-generator-cli version && exit 0
55
+ sleep $((attempt * 5))
56
+ done
57
+ exit 1
58
+
59
+ - name: Compute the next version
60
+ id: version
61
+ run: |
62
+ CURRENT=$(grep -oP '(?<=^version = ")[^"]+' pyproject.toml)
63
+ NEXT=$(python -c "v='$CURRENT'.split('.'); v[-1]=str(int(v[-1])+1); print('.'.join(v))")
64
+ echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
65
+ echo "next=$NEXT" >> "$GITHUB_OUTPUT"
66
+
67
+ # The gate's copy carries the current version, so the diff is only the spec's.
68
+ - name: Regenerate from the live spec
69
+ run: python scripts/generate.py --version ${{ steps.version.outputs.current }}
70
+
71
+ - name: Check for changes
72
+ id: changes
73
+ run: |
74
+ if [ "${{ inputs.release }}" = "true" ]; then
75
+ echo "Release asked for."
76
+ echo "has_changes=true" >> "$GITHUB_OUTPUT"
77
+ elif [ -z "$(git status --porcelain -- src/ tests/ README.md)" ]; then
78
+ echo "The SDK already matches the live spec."
79
+ echo "has_changes=false" >> "$GITHUB_OUTPUT"
80
+ else
81
+ git status --short
82
+ echo "has_changes=true" >> "$GITHUB_OUTPUT"
83
+ fi
84
+
85
+ - name: Regenerate with the release version
86
+ if: steps.changes.outputs.has_changes == 'true'
87
+ run: |
88
+ python scripts/generate.py --version ${{ steps.version.outputs.next }}
89
+ sed -i "s/^version = \".*\"/version = \"${{ steps.version.outputs.next }}\"/" pyproject.toml
90
+
91
+ - name: Test
92
+ if: steps.changes.outputs.has_changes == 'true'
93
+ run: |
94
+ python -m pip install --upgrade pip
95
+ pip install -e ".[dev]"
96
+ pytest
97
+
98
+ - name: Commit
99
+ if: steps.changes.outputs.has_changes == 'true'
100
+ run: |
101
+ git config user.name "github-actions[bot]"
102
+ git config user.email "github-actions[bot]@users.noreply.github.com"
103
+ git add src/ tests/ README.md pyproject.toml
104
+ git commit -m "Regenerate from the OpenAPI spec (v${{ steps.version.outputs.next }})"
105
+
106
+ # Two dispatches close together race for main; the fresher regeneration wins.
107
+ - name: Push
108
+ if: steps.changes.outputs.has_changes == 'true'
109
+ run: |
110
+ for attempt in 1 2 3; do
111
+ git push && exit 0
112
+ git pull --rebase -X theirs origin main
113
+ sleep $((attempt * 5))
114
+ done
115
+ echo "::error::Could not push after 3 attempts."
116
+ exit 1
117
+
118
+ - name: Check whether this version is published
119
+ if: steps.changes.outputs.has_changes == 'true'
120
+ id: published
121
+ run: |
122
+ if curl -sf "https://pypi.org/pypi/socialapihq/${{ steps.version.outputs.next }}/json" > /dev/null; then
123
+ echo "skip=true" >> "$GITHUB_OUTPUT"
124
+ else
125
+ echo "skip=false" >> "$GITHUB_OUTPUT"
126
+ fi
127
+
128
+ - name: Build
129
+ if: steps.changes.outputs.has_changes == 'true' && steps.published.outputs.skip != 'true'
130
+ run: |
131
+ pip install build
132
+ python -m build
133
+
134
+ - name: Publish to PyPI
135
+ if: steps.changes.outputs.has_changes == 'true' && steps.published.outputs.skip != 'true'
136
+ uses: pypa/gh-action-pypi-publish@release/v1
137
+
138
+ - name: Create the GitHub release
139
+ if: steps.changes.outputs.has_changes == 'true' && steps.published.outputs.skip != 'true'
140
+ uses: softprops/action-gh-release@v2
141
+ with:
142
+ tag_name: v${{ steps.version.outputs.next }}
143
+ name: v${{ steps.version.outputs.next }}
144
+ generate_release_notes: true
145
+ body: |
146
+ Regenerated from the API's OpenAPI spec.
147
+
148
+ ```sh
149
+ pip install socialapihq==${{ steps.version.outputs.next }}
150
+ ```
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ .pytest_cache/
5
+ dist/
6
+ build/
7
+ *.egg-info/
8
+ .env
9
+ .env.*
10
+ node_modules/
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,243 @@
1
+ Metadata-Version: 2.5
2
+ Name: socialapihq
3
+ Version: 0.1.3
4
+ Summary: The official Python SDK for SocialAPI: public social media data from TikTok, Instagram, Threads and Facebook in one schema
5
+ Project-URL: Homepage, https://socialapi.sh
6
+ Project-URL: Documentation, https://socialapi.sh/docs
7
+ Project-URL: Repository, https://github.com/socialapihq/socialapi-python
8
+ Author-email: SocialAPI <support@socialapi.sh>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: api,facebook,instagram,scraping,sdk,social-media,socialapi,threads,tiktok
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: pydantic>=2.11
23
+ Requires-Dist: python-dateutil>=2.8.2
24
+ Requires-Dist: typing-extensions>=4.7.1
25
+ Requires-Dist: urllib3<3.0.0,>=2.1.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=8.0; extra == 'dev'
28
+ Description-Content-Type: text/markdown
29
+
30
+ <p align="center">
31
+ <a href="https://socialapi.sh">
32
+ <img src="https://socialapi.sh/og.png" alt="SocialAPI: public social media data in one schema" width="640">
33
+ </a>
34
+ </p>
35
+
36
+ <p align="center">
37
+ <a href="https://pypi.org/project/socialapihq/"><img src="https://img.shields.io/pypi/v/socialapihq.svg" alt="PyPI version"></a>
38
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue.svg" alt="License"></a>
39
+ </p>
40
+
41
+ <p align="center">
42
+ Official Python SDK for the <a href="https://socialapi.sh">SocialAPI</a>: profiles, posts, comments, transcripts,<br>
43
+ searches and trends from TikTok, Instagram, Threads and Facebook, in one schema. See the <a href="https://socialapi.sh/docs">docs</a> for every endpoint.
44
+ </p>
45
+
46
+ <p align="center">
47
+ Python 3.10+. Typed with Pydantic.
48
+ </p>
49
+
50
+ ## Installation
51
+
52
+ ```sh
53
+ pip install socialapihq
54
+ ```
55
+
56
+ ## Usage
57
+
58
+ Each platform is an attribute of the client and each endpoint a method on it. Create an API key in the [dashboard](https://app.socialapi.sh); it is sent as `Authorization: Bearer sapi_…`, and every account starts with 100 free credits.
59
+
60
+ ```python
61
+ import os
62
+
63
+ from socialapihq import SocialAPI
64
+
65
+ client = SocialAPI(api_key=os.environ["SOCIALAPI_API_KEY"])
66
+
67
+ profile = client.tiktok.profile(handle="nike").data
68
+ print(profile.display_name, profile.followers) # Nike 9440793
69
+
70
+ for post in client.instagram.profile_posts(handle="natgeo").data:
71
+ print(post.url, post.stats.likes)
72
+ ```
73
+
74
+ Methods take the endpoint's parameters as keyword arguments in snake case (`secUid` is `sec_uid`) and return typed models: `.data` for one item, `.data` and `.pagination` for a list. Every platform answers with the same field names, and what only one platform has sits under `ext`. `api_key` defaults to the `SOCIALAPI_API_KEY` environment variable.
75
+
76
+ Models are Pydantic: `.model_dump()` gives a dict, `.to_json()` the JSON.
77
+
78
+ ### Pagination
79
+
80
+ A list answers `pagination.next_cursor` while `pagination.has_more` is true. Pass it back as `cursor` for the next page:
81
+
82
+ ```python
83
+ cursor = None
84
+ while True:
85
+ page = client.tiktok.profile_posts(handle="nike", cursor=cursor)
86
+ for post in page.data:
87
+ print(post.id, post.stats.views)
88
+ if not page.pagination.has_more:
89
+ break
90
+ cursor = page.pagination.next_cursor
91
+ ```
92
+
93
+ Each page costs credits like any call. A cached answer is free.
94
+
95
+ ### Transcripts
96
+
97
+ ```python
98
+ transcript = client.tiktok.post_transcript(
99
+ url="https://www.tiktok.com/@nike/video/7711414040114892045",
100
+ ).data
101
+
102
+ print(transcript.language, transcript.text)
103
+ for cue in transcript.cues:
104
+ print(cue.start_seconds, cue.text) # 0.02 Pole or podium?
105
+ ```
106
+
107
+ A transcript costs 5 credits and is cached for 30 days.
108
+
109
+ ### Error handling
110
+
111
+ A refused call raises a `SocialAPIError`. Its `code` is stable to build logic on, and refused calls cost no credits:
112
+
113
+ ```python
114
+ from socialapihq import SocialAPIError
115
+
116
+ try:
117
+ client.instagram.profile(handle="no-such-account")
118
+ except SocialAPIError as error:
119
+ print(error.status, error.code, error.message, error.request_id)
120
+ # 404 NOT_FOUND No Instagram account matches this handle. req_…
121
+ ```
122
+
123
+ `RATE_LIMITED` errors carry `retry_after` in seconds. See [Errors](https://socialapi.sh/docs/errors) for every code.
124
+
125
+ ### Configuration
126
+
127
+ ```python
128
+ client = SocialAPI(
129
+ api_key="sapi_…",
130
+ base_url="https://api.socialapi.sh", # the default
131
+ timeout=30, # seconds to wait for each answer
132
+ )
133
+
134
+ with SocialAPI() as client: # closes its connections at the end
135
+ print(client.account.get_credits().balance)
136
+ ```
137
+
138
+ The generated classes (`TikTokApi`, `InstagramApi`…) are exported too. Their `…_with_http_info` methods give the status and headers, such as `X-Credits-Charged`.
139
+
140
+ ## API reference
141
+
142
+ <!-- BEGIN GENERATED API REFERENCE -->
143
+
144
+ ### Facebook
145
+
146
+ | Method | Description |
147
+ | --- | --- |
148
+ | `facebook.event()` | One event |
149
+ | `facebook.events()` | A city's upcoming events |
150
+ | `facebook.events_search()` | Events matching a query |
151
+ | `facebook.marketplace_item()` | One Marketplace listing |
152
+ | `facebook.marketplace_search()` | Marketplace listings for a query near a point |
153
+ | `facebook.post()` | One post |
154
+ | `facebook.post_comment_replies()` | The replies to one comment |
155
+ | `facebook.post_comments()` | A post's comments |
156
+ | `facebook.post_transcript()` | A video's captions as text with their times |
157
+ | `facebook.profile()` | A Page or a public person |
158
+ | `facebook.profile_photos()` | A Page's or person's photos |
159
+ | `facebook.profile_posts()` | A Page's or person's posts |
160
+ | `facebook.profile_videos()` | A Page's videos with their plays |
161
+
162
+ ### Instagram
163
+
164
+ | Method | Description |
165
+ | --- | --- |
166
+ | `instagram.highlight()` | A story highlight's stories |
167
+ | `instagram.location()` | A place |
168
+ | `instagram.location_posts()` | A place's top posts with their likes and comments |
169
+ | `instagram.post()` | One post or reel with its counts |
170
+ | `instagram.post_comments()` | A post's comments with their likes |
171
+ | `instagram.profile()` | A profile with its follower and following counts |
172
+ | `instagram.profile_highlights()` | An account's story highlights |
173
+ | `instagram.profile_posts()` | An account's posts |
174
+ | `instagram.profile_reels()` | An account's reels with their plays |
175
+ | `instagram.profile_similar()` | Accounts like this one |
176
+ | `instagram.search()` | Popular posts for a word or hashtag |
177
+ | `instagram.sound()` | A sound |
178
+ | `instagram.sound_posts()` | The reels that use a sound |
179
+ | `instagram.trending()` | The reels feed Instagram gives a visitor |
180
+ | `instagram.trending_topics()` | The explore page's trending keywords and accounts |
181
+
182
+ ### Threads
183
+
184
+ | Method | Description |
185
+ | --- | --- |
186
+ | `threads.post()` | One thread with its counts |
187
+ | `threads.post_comments()` | A thread's replies |
188
+ | `threads.profile()` | A profile with its follower count |
189
+ | `threads.profile_media()` | An account's threads with photos or videos |
190
+ | `threads.profile_posts()` | An account's threads |
191
+ | `threads.profile_replies()` | An account's replies to other threads |
192
+ | `threads.profile_reposts()` | Other people's threads an account reposted |
193
+ | `threads.search()` | Threads matching a query |
194
+ | `threads.search_users()` | Accounts matching a name |
195
+ | `threads.trending()` | The feed Threads gives a visitor now |
196
+
197
+ ### TikTok
198
+
199
+ | Method | Description |
200
+ | --- | --- |
201
+ | `tiktok.collection_posts()` | The posts of a public saved collection |
202
+ | `tiktok.hashtag()` | A hashtag with its post and view counts |
203
+ | `tiktok.hashtag_posts()` | Posts under a hashtag |
204
+ | `tiktok.live()` | Whether an account is live |
205
+ | `tiktok.playlist_posts()` | The posts of a playlist |
206
+ | `tiktok.post()` | One post with its counts |
207
+ | `tiktok.post_comment_replies()` | The replies to one comment |
208
+ | `tiktok.post_comments()` | A post's top-level comments |
209
+ | `tiktok.post_related()` | Posts TikTok recommends beside one post |
210
+ | `tiktok.post_transcript()` | A post's captions as text with their times |
211
+ | `tiktok.profile()` | A profile with its exact follower and like counts |
212
+ | `tiktok.profile_followers()` | An account's followers |
213
+ | `tiktok.profile_following()` | The accounts an account follows |
214
+ | `tiktok.profile_liked()` | Posts an account liked |
215
+ | `tiktok.profile_playlists()` | The playlists an account made |
216
+ | `tiktok.profile_posts()` | An account's posts |
217
+ | `tiktok.profile_reposts()` | Other people's posts an account reposted |
218
+ | `tiktok.search()` | Posts matching a query |
219
+ | `tiktok.search_users()` | Accounts matching a query |
220
+ | `tiktok.sound()` | A sound |
221
+ | `tiktok.sound_posts()` | Posts that use a sound |
222
+ | `tiktok.trending()` | What the explore page shows now |
223
+
224
+ ### Account
225
+
226
+ | Method | Description |
227
+ | --- | --- |
228
+ | `account.get_credits()` | The credits left in your workspace |
229
+
230
+ <!-- END GENERATED API REFERENCE -->
231
+
232
+ Query parameters are keyword arguments of the method, such as `handle="nike", cursor=cursor`. Every endpoint, with its parameters and a real answer, is in the [API Reference](https://socialapi.sh/docs/api-reference).
233
+
234
+ ## Links
235
+
236
+ - [Documentation](https://socialapi.sh/docs)
237
+ - [API Reference](https://socialapi.sh/docs/api-reference)
238
+ - [Dashboard](https://app.socialapi.sh)
239
+ - [OpenAPI spec](https://api.socialapi.sh/openapi.json)
240
+
241
+ ## License
242
+
243
+ Apache-2.0