mirror of
				https://github.com/simon987/parler-tricks.git
				synced 2025-10-31 00:46:56 +00:00 
			
		
		
		
	reformat, add setup.py
This commit is contained in:
		
							parent
							
								
									5c295ab1d8
								
							
						
					
					
						commit
						89ce04d3d1
					
				
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +1,3 @@ | |||||||
| parler/__pycache__/ | parler/__pycache__/ | ||||||
|  | .idea/ | ||||||
|  | *.pyc | ||||||
|  | |||||||
| @ -1,12 +1,13 @@ | |||||||
| import uuid | import uuid | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| class AuthenticationAPI: | class AuthenticationAPI: | ||||||
|     def __init__(self, session, root_url="http://api.parler.com"): |     def __init__(self, session, root_url="http://api.parler.com"): | ||||||
|         self.root_url = root_url |         self.root_url = root_url | ||||||
|         self.s = session |         self.s = session | ||||||
| 
 | 
 | ||||||
|     def add_password_to_account(self, password, passwordConfirm): |     def add_password_to_account(self, password, passwordConfirm): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/login/passwordSetup |         POST /v1/login/passwordSetup | ||||||
|         params: |         params: | ||||||
|             password |             password | ||||||
| @ -15,7 +16,7 @@ class AuthenticationAPI: | |||||||
|             400: {"message": "This person already has a password set, and can not be set through this API"} |             400: {"message": "This person already has a password set, and can not be set through this API"} | ||||||
|         rate-limit: 5 |         rate-limit: 5 | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v1/login/passwordSetup".format(self.root_url), |             "{}/v1/login/passwordSetup".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -24,7 +25,7 @@ class AuthenticationAPI: | |||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
|     def authenticate(self, email, password, captchaToken, captchaValue, deviceId=None): |     def authenticate(self, email, password, captchaToken, captchaValue, deviceId=None): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/login |         POST /v1/login | ||||||
|         params: |         params: | ||||||
|             email |             email | ||||||
| @ -37,7 +38,7 @@ class AuthenticationAPI: | |||||||
|         response: |         response: | ||||||
|         rate-limit: 5 |         rate-limit: 5 | ||||||
|         auth: no |         auth: no | ||||||
|         ''' |         """ | ||||||
|         if deviceId is None: |         if deviceId is None: | ||||||
|             deviceId = str(uuid.uuid4()) |             deviceId = str(uuid.uuid4()) | ||||||
| 
 | 
 | ||||||
| @ -52,7 +53,7 @@ class AuthenticationAPI: | |||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
|     def begin_registration_otp(self): |     def begin_registration_otp(self): | ||||||
|         ''' |         """ | ||||||
|         GET /v1/login/otp/registration |         GET /v1/login/otp/registration | ||||||
|             returns OTP token as base64 QR code and secret |             returns OTP token as base64 QR code and secret | ||||||
|         response: |         response: | ||||||
| @ -60,11 +61,11 @@ class AuthenticationAPI: | |||||||
|             200: {"message": "OK"} - if already added |             200: {"message": "OK"} - if already added | ||||||
|         rate-limit: 5 |         rate-limit: 5 | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.get("{}/v1/login/otp/registration".format(self.root_url)) |         return self.s.get("{}/v1/login/otp/registration".format(self.root_url)) | ||||||
| 
 | 
 | ||||||
|     def change_password(self, password, new_password): |     def change_password(self, password, new_password): | ||||||
|         ''' |         """ | ||||||
|         PATCH /v1/profile |         PATCH /v1/profile | ||||||
|         params: |         params: | ||||||
|             passwordOld |             passwordOld | ||||||
| @ -74,7 +75,7 @@ class AuthenticationAPI: | |||||||
|             400: { "message": "The provided name and password provided do not match", "fieldvalidationsMap": [] } |             400: { "message": "The provided name and password provided do not match", "fieldvalidationsMap": [] } | ||||||
|         rate-limit: 4 |         rate-limit: 4 | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.patch( |         return self.s.patch( | ||||||
|             "{}/v1/profile".format(self.root_url), |             "{}/v1/profile".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -84,16 +85,16 @@ class AuthenticationAPI: | |||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
|     def checkin(self): |     def checkin(self): | ||||||
|         ''' |         """ | ||||||
|         GET /v1/checkin |         GET /v1/checkin | ||||||
|             removed |             removed | ||||||
|         ''' |         """ | ||||||
|         return self.s.get( |         return self.s.get( | ||||||
|             "{}/v1/checkin" |             "{}/v1/checkin" | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def create_account(self, email, password, captchaToken, captchaValue, deviceId=None): |     def create_account(self, email, password, captchaToken, captchaValue, deviceId=None): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/login/register |         POST /v1/login/register | ||||||
|             removed, replaced by V2 API |             removed, replaced by V2 API | ||||||
|         params: |         params: | ||||||
| @ -108,7 +109,7 @@ class AuthenticationAPI: | |||||||
|             captchaValue |             captchaValue | ||||||
|         response: |         response: | ||||||
|             404: replaced by V2 Auth API |             404: replaced by V2 Auth API | ||||||
|         ''' |         """ | ||||||
|         if deviceId is None: |         if deviceId is None: | ||||||
|             deviceId = str(uuid.uuid4()) |             deviceId = str(uuid.uuid4()) | ||||||
| 
 | 
 | ||||||
| @ -124,7 +125,7 @@ class AuthenticationAPI: | |||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
|     def disable_otp(self, totp): |     def disable_otp(self, totp): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/login/otp/deregistration |         POST /v1/login/otp/deregistration | ||||||
|         params: |         params: | ||||||
|             totp |             totp | ||||||
| @ -132,7 +133,7 @@ class AuthenticationAPI: | |||||||
|             403: {"message": "Invalid OTP code provided, please try again"} |             403: {"message": "Invalid OTP code provided, please try again"} | ||||||
|         rate-limit: 5 |         rate-limit: 5 | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v1/login/otp/deregistration".format(self.root_url), |             "{}/v1/login/otp/deregistration".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -140,19 +141,19 @@ class AuthenticationAPI: | |||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
|     def email_use_status(self, email): |     def email_use_status(self, email): | ||||||
|         ''' |         """ | ||||||
|         GET /v1/login/{email} |         GET /v1/login/{email} | ||||||
|         response: |         response: | ||||||
|             200: {"message": "HAS_PASSWORD"} |             200: {"message": "HAS_PASSWORD"} | ||||||
|         rate-limit: 5 |         rate-limit: 5 | ||||||
|         auth: no |         auth: no | ||||||
|         ''' |         """ | ||||||
|         return self.s.get( |         return self.s.get( | ||||||
|             "{}/v1/login/{}".format(self.root_url, email) |             "{}/v1/login/{}".format(self.root_url, email) | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def enroll_otp(self, totp, secret): |     def enroll_otp(self, totp, secret): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/login/otp/registration |         POST /v1/login/otp/registration | ||||||
|         params: |         params: | ||||||
|             totp |             totp | ||||||
| @ -161,7 +162,7 @@ class AuthenticationAPI: | |||||||
|             200: {"message": "OK"} |             200: {"message": "OK"} | ||||||
|         rate-limit: 5 |         rate-limit: 5 | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v1/login/otp/registration".format(self.root_url), |             "{}/v1/login/otp/registration".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -170,23 +171,23 @@ class AuthenticationAPI: | |||||||
|             }) |             }) | ||||||
| 
 | 
 | ||||||
|     def get_a_captcha(self): |     def get_a_captcha(self): | ||||||
|         ''' |         """ | ||||||
|         GET /v1/login/captcha |         GET /v1/login/captcha | ||||||
|             base64 png |             base64 png | ||||||
|         response: |         response: | ||||||
|             200: {"captchaToken": "00cd2762aeea4bc3ae93f504d739de88", "data": "/9j/2wBDAAY..."} |             200: {"captchaToken": "00cd2762aeea4bc3ae93f504d739de88", "data": "/9j/2wBDAAY..."} | ||||||
|         rate-limit: 6 |         rate-limit: 6 | ||||||
|         auth: no |         auth: no | ||||||
|         ''' |         """ | ||||||
|         return self.s.get("{}/v1/login/captcha".format(self.root_url)) |         return self.s.get("{}/v1/login/captcha".format(self.root_url)) | ||||||
| 
 | 
 | ||||||
|     def logout(self, authenticationToken): |     def logout(self, authenticationToken): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/logout |         POST /v1/logout | ||||||
|         params: |         params: | ||||||
|             authenticationToken |             authenticationToken | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v1/logout".format(self.root_url), |             "{}/v1/logout".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -195,7 +196,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def request_password_reset(self, email): |     def request_password_reset(self, email): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/login/resetReqeust |         POST /v1/login/resetReqeust | ||||||
|         params: |         params: | ||||||
|             email |             email | ||||||
| @ -203,7 +204,7 @@ class AuthenticationAPI: | |||||||
|             200: {"message": "OK"} |             200: {"message": "OK"} | ||||||
|         rate-limit: 3 |         rate-limit: 3 | ||||||
|         auth: no |         auth: no | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v1/login/resetRequest".format(self.root_url), |             "{}/v1/login/resetRequest".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -212,7 +213,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def request_signin_link_for_email(self, email, captchaToken, captchaValue, deviceId): |     def request_signin_link_for_email(self, email, captchaToken, captchaValue, deviceId): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/signin/request |         POST /v1/signin/request | ||||||
|             removed |             removed | ||||||
|         params: |         params: | ||||||
| @ -222,7 +223,7 @@ class AuthenticationAPI: | |||||||
|             captchaValue |             captchaValue | ||||||
|         response: |         response: | ||||||
|             404: {"message": "No resource for URL", "fieldvalidationsMap": []}} |             404: {"message": "No resource for URL", "fieldvalidationsMap": []}} | ||||||
|         ''' |         """ | ||||||
|         if deviceId is None: |         if deviceId is None: | ||||||
|             deviceId = str(uuid.uuid4()) |             deviceId = str(uuid.uuid4()) | ||||||
| 
 | 
 | ||||||
| @ -237,7 +238,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def reset_user_password(self, password, passwordConfirm, resetToken): |     def reset_user_password(self, password, passwordConfirm, resetToken): | ||||||
|         ''' |         """ | ||||||
|         POST /v2/login/password/reset/submit |         POST /v2/login/password/reset/submit | ||||||
|         params: |         params: | ||||||
|             password |             password | ||||||
| @ -247,7 +248,7 @@ class AuthenticationAPI: | |||||||
|             400: {"message": "Verification code expired", "fieldvalidationsMap": [] } |             400: {"message": "Verification code expired", "fieldvalidationsMap": [] } | ||||||
|         rate-limit: 4 |         rate-limit: 4 | ||||||
|         auth: no |         auth: no | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v2/login/password/reset/submit".format(self.root_url), |             "{}/v2/login/password/reset/submit".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -258,7 +259,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def send_email_reminder(self, username): |     def send_email_reminder(self, username): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/login/reminder |         POST /v1/login/reminder | ||||||
|             sends email reminder for username |             sends email reminder for username | ||||||
|         params: |         params: | ||||||
| @ -267,7 +268,7 @@ class AuthenticationAPI: | |||||||
|             200: {"message": "success"} |             200: {"message": "success"} | ||||||
|         rate-limit: 15 |         rate-limit: 15 | ||||||
|         auth: no |         auth: no | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v1/login/reminder".format(self.root_url), |             "{}/v1/login/reminder".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -276,7 +277,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def send_notification_token(self, notificationId): |     def send_notification_token(self, notificationId): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/notification |         POST /v1/notification | ||||||
|             Mobile push notification token |             Mobile push notification token | ||||||
|         params: |         params: | ||||||
| @ -285,7 +286,7 @@ class AuthenticationAPI: | |||||||
|             200: {"message": "success"} |             200: {"message": "success"} | ||||||
|         rate-limit: 5 |         rate-limit: 5 | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v1/notification".format(self.root_url), |             "{}/v1/notification".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
| @ -294,7 +295,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def sign_in_with_email(self, email, code, deviceId=None): |     def sign_in_with_email(self, email, code, deviceId=None): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/signin |         POST /v1/signin | ||||||
|             sign in using code sent to email. removed |             sign in using code sent to email. removed | ||||||
|         params: |         params: | ||||||
| @ -306,7 +307,7 @@ class AuthenticationAPI: | |||||||
|             notificationId |             notificationId | ||||||
|         response: |         response: | ||||||
|             404: { "message": "No resource for URL", "fieldvalidationsMap": [] } |             404: { "message": "No resource for URL", "fieldvalidationsMap": [] } | ||||||
|         ''' |         """ | ||||||
|         if deviceId is None: |         if deviceId is None: | ||||||
|             deviceId = str(uuid.uuid4()) |             deviceId = str(uuid.uuid4()) | ||||||
| 
 | 
 | ||||||
| @ -320,7 +321,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def sign_up_email(self, email, name, deviceId=None): |     def sign_up_email(self, email, name, deviceId=None): | ||||||
|         ''' |         """ | ||||||
|         POST /v1/signup |         POST /v1/signup | ||||||
|             removed |             removed | ||||||
|         params: |         params: | ||||||
| @ -329,7 +330,7 @@ class AuthenticationAPI: | |||||||
|             deviceId |             deviceId | ||||||
|         response: |         response: | ||||||
|             404: { "message": "No resource for URL", "fieldvalidationsMap": [] } |             404: { "message": "No resource for URL", "fieldvalidationsMap": [] } | ||||||
|         ''' |         """ | ||||||
|         if deviceId is None: |         if deviceId is None: | ||||||
|             deviceId = str(uuid.uuid4()) |             deviceId = str(uuid.uuid4()) | ||||||
| 
 | 
 | ||||||
| @ -343,7 +344,7 @@ class AuthenticationAPI: | |||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def verify_reset_code(self, token): |     def verify_reset_code(self, token): | ||||||
|         ''' |         """ | ||||||
|         POST /v2/login/password/reset/verify |         POST /v2/login/password/reset/verify | ||||||
|         params: |         params: | ||||||
|             email (optional) |             email (optional) | ||||||
| @ -353,11 +354,10 @@ class AuthenticationAPI: | |||||||
|             200: {"valid": true} |             200: {"valid": true} | ||||||
|         rate-limit: 4 |         rate-limit: 4 | ||||||
|         auth: no |         auth: no | ||||||
|         ''' |         """ | ||||||
|         return self.s.post( |         return self.s.post( | ||||||
|             "{}/v2/login/password/reset/verify".format(self.root_url), |             "{}/v2/login/password/reset/verify".format(self.root_url), | ||||||
|             data={ |             data={ | ||||||
|                 'token': token, |                 'token': token, | ||||||
|             } |             } | ||||||
|         ) |         ) | ||||||
|      |  | ||||||
|  | |||||||
| @ -1,4 +1,3 @@ | |||||||
| 
 |  | ||||||
| class CampaignManagementAPI: | class CampaignManagementAPI: | ||||||
|     def __init__(self, session, root_url="http://api.parler.com"): |     def __init__(self, session, root_url="http://api.parler.com"): | ||||||
|         self.root_url = root_url |         self.root_url = root_url | ||||||
| @ -23,4 +22,5 @@ class CampaignManagementAPI: | |||||||
|         return self.s.post("{}/v3/promotionNetwork/campaign".format(self.root_url), *args, *kwargs) |         return self.s.post("{}/v3/promotionNetwork/campaign".format(self.root_url), *args, *kwargs) | ||||||
| 
 | 
 | ||||||
|     def submit_campaign(self, identifier, *args, **kwargs): |     def submit_campaign(self, identifier, *args, **kwargs): | ||||||
|         return self.s.post("{}/v3/promotionNetwork/campaign/{}/submit".format(self.root_url, identifier), *args, *kwargs) |         return self.s.post("{}/v3/promotionNetwork/campaign/{}/submit".format(self.root_url, identifier), *args, | ||||||
|  |                            *kwargs) | ||||||
|  | |||||||
| @ -1,21 +1,26 @@ | |||||||
| 
 |  | ||||||
| class CampaignManagementPromoterAPI: | class CampaignManagementPromoterAPI: | ||||||
|     def __init__(self, session, root_url="http://api.parler.com"): |     def __init__(self, session, root_url="http://api.parler.com"): | ||||||
|         self.root_url = root_url |         self.root_url = root_url | ||||||
|         self.s = session |         self.s = session | ||||||
| 
 | 
 | ||||||
|     def add_promoter_for_request(self, identifier, *args, **kwargs): |     def add_promoter_for_request(self, identifier, *args, **kwargs): | ||||||
|         return self.s.post("{}/v3/promotionNetwork/campaign/{}/promoter".format(self.root_url, identifier), *args, **kwargs) |         return self.s.post("{}/v3/promotionNetwork/campaign/{}/promoter".format(self.root_url, identifier), *args, | ||||||
|  |                            **kwargs) | ||||||
| 
 | 
 | ||||||
|     def get_details_for_promoter(self, campaignId, promoterId, *args, **kwargs): |     def get_details_for_promoter(self, campaignId, promoterId, *args, **kwargs): | ||||||
|         return self.s.get("{}/v3/promotionNetwork/campaign/{}/promoter/{}".format(self.root_url, campaignId, promoterId), *args, **kwargs) |         return self.s.get( | ||||||
|  |             "{}/v3/promotionNetwork/campaign/{}/promoter/{}".format(self.root_url, campaignId, promoterId), *args, | ||||||
|  |             **kwargs) | ||||||
| 
 | 
 | ||||||
|     def get_current_list_of_promoters_for_campaign(self, campaignId, *args, **kwargs): |     def get_current_list_of_promoters_for_campaign(self, campaignId, *args, **kwargs): | ||||||
|         return self.s.get("{}/v3/promotionNetwork/campaign/{}/promoters".format(self.root_url, campaignId), *args, **kwargs) |         return self.s.get("{}/v3/promotionNetwork/campaign/{}/promoters".format(self.root_url, campaignId), *args, | ||||||
|  |                           **kwargs) | ||||||
| 
 | 
 | ||||||
|     def get_list_of_possible_promoters_for_campaign(self, campaignId, *args, **kwargs): |     def get_list_of_possible_promoters_for_campaign(self, campaignId, *args, **kwargs): | ||||||
|         return self.s.get("{}/v3/promotionNetwork/campaign/{}/promoters/new".format(self.root_url, campaignId), *args, **kwargs) |         return self.s.get("{}/v3/promotionNetwork/campaign/{}/promoters/new".format(self.root_url, campaignId), *args, | ||||||
|  |                           **kwargs) | ||||||
| 
 | 
 | ||||||
|     def remove_promoter_from_campaign(self, campaignId, promoterId, *args, **kwargs): |     def remove_promoter_from_campaign(self, campaignId, promoterId, *args, **kwargs): | ||||||
|         return self.s.delete("{}/v3/promotionNetwork/campaign/{}/promoter/{}".format(self.root_url, campaignId, promoterId), *args, **kwargs) |         return self.s.delete( | ||||||
| 
 |             "{}/v3/promotionNetwork/campaign/{}/promoter/{}".format(self.root_url, campaignId, promoterId), *args, | ||||||
|  |             **kwargs) | ||||||
|  | |||||||
| @ -1,4 +1,3 @@ | |||||||
| 
 |  | ||||||
| class CommentsAPI: | class CommentsAPI: | ||||||
|     def __init__(self, session, root_url="http://api.parler.com"): |     def __init__(self, session, root_url="http://api.parler.com"): | ||||||
|         self.root_url = root_url |         self.root_url = root_url | ||||||
|  | |||||||
| @ -1,4 +1,3 @@ | |||||||
| 
 |  | ||||||
| class ContactsUploaderAPI: | class ContactsUploaderAPI: | ||||||
|     def __init__(self, session, root_url="http://api.parler.com"): |     def __init__(self, session, root_url="http://api.parler.com"): | ||||||
|         self.root_url = root_url |         self.root_url = root_url | ||||||
| @ -14,5 +13,6 @@ class ContactsUploaderAPI: | |||||||
|         }] |         }] | ||||||
|     } |     } | ||||||
|     ''' |     ''' | ||||||
|  | 
 | ||||||
|     def start_uploading(self, *args, **kwargs): |     def start_uploading(self, *args, **kwargs): | ||||||
|         return self.s.post("{}/v2/contacts".format(self.root_url), *args, **kwargs) |         return self.s.post("{}/v2/contacts".format(self.root_url), *args, **kwargs) | ||||||
| @ -1,11 +1,10 @@ | |||||||
| 
 |  | ||||||
| class ConversionAPI: | class ConversionAPI: | ||||||
|     def __init__(self, session, root_url="http://api.parler.com"): |     def __init__(self, session, root_url="http://api.parler.com"): | ||||||
|         self.root_url = root_url |         self.root_url = root_url | ||||||
|         self.s = session |         self.s = session | ||||||
| 
 | 
 | ||||||
|     def convert(self, _type, uuid): |     def convert(self, _type, uuid): | ||||||
|         ''' |         """ | ||||||
|         GET /v3/idConversion/{type}/{uuid} |         GET /v3/idConversion/{type}/{uuid} | ||||||
|         params: |         params: | ||||||
|             type: one of (user, post, comment, image, video, link) |             type: one of (user, post, comment, image, video, link) | ||||||
| @ -14,13 +13,13 @@ class ConversionAPI: | |||||||
|             hidden sequential ID, as protobuf varint |             hidden sequential ID, as protobuf varint | ||||||
|         rate-limit: none |         rate-limit: none | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.get( |         return self.s.get( | ||||||
|             "{}/v3/idConversion/{}/{}".format(self.root_url, _type, uuid) |             "{}/v3/idConversion/{}/{}".format(self.root_url, _type, uuid) | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|     def reverse_convert(self, _type, _id): |     def reverse_convert(self, _type, _id): | ||||||
|         ''' |         """ | ||||||
|         GET /v3/uuidConversion/{type}/{id} |         GET /v3/uuidConversion/{type}/{id} | ||||||
|             (*) this is enumerable |             (*) this is enumerable | ||||||
|         params: |         params: | ||||||
| @ -30,7 +29,7 @@ class ConversionAPI: | |||||||
|             public-facing UUID of the entity |             public-facing UUID of the entity | ||||||
|         rate-limit: none |         rate-limit: none | ||||||
|         auth: yes |         auth: yes | ||||||
|         ''' |         """ | ||||||
|         return self.s.get( |         return self.s.get( | ||||||
|             "{}/v3/uuidConversion/{}/{}".format(self.root_url, _type, _id) |             "{}/v3/uuidConversion/{}/{}".format(self.root_url, _type, _id) | ||||||
|         ) |         ) | ||||||
| @ -6,4 +6,3 @@ class FlagsAPI: | |||||||
|     def get_flags_for(self, userUuid, *args, **kwargs): |     def get_flags_for(self, userUuid, *args, **kwargs): | ||||||
|         # i have no idea what this is |         # i have no idea what this is | ||||||
|         return self.s.get("{}/v3/flags/user/uuid/{}".format(self.root_url, userUuid), *args, **kwargs) |         return self.s.get("{}/v3/flags/user/uuid/{}".format(self.root_url, userUuid), *args, **kwargs) | ||||||
|   |  | ||||||
| @ -33,12 +33,14 @@ from parler.wallet_general import WalletGeneralAPI | |||||||
| from parler.wallet import WalletAPI | from parler.wallet import WalletAPI | ||||||
| import requests | import requests | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| class Parler: | class Parler: | ||||||
|     ''' |     ''' | ||||||
|     the api is accessible at api.parler.com and par.pw. |     the api is accessible at api.parler.com and par.pw. | ||||||
|     staging api = api.speak-free.com |     staging api = api.speak-free.com | ||||||
|     mst and jst cookie are same as on web |     mst and jst cookie are same as on web | ||||||
|     ''' |     ''' | ||||||
|  | 
 | ||||||
|     def __init__(self, mst=None, jst=None, root_url="https://api.parler.com"): |     def __init__(self, mst=None, jst=None, root_url="https://api.parler.com"): | ||||||
|         session = requests.Session() |         session = requests.Session() | ||||||
|         session.headers['User-Agent'] = 'Parler%20Staging/545 CFNetwork/978.0.7 Darwin 18.7.0' |         session.headers['User-Agent'] = 'Parler%20Staging/545 CFNetwork/978.0.7 Darwin 18.7.0' | ||||||
|  | |||||||
| @ -15,7 +15,6 @@ class PostsAPI: | |||||||
|     def get_posts_using_urls(self, *args, **kwargs): |     def get_posts_using_urls(self, *args, **kwargs): | ||||||
|         return self.s.post("{}/v1/wordpress/posts".format(self.root_url), *args, **kwargs) |         return self.s.post("{}/v1/wordpress/posts".format(self.root_url), *args, **kwargs) | ||||||
| 
 | 
 | ||||||
|      |  | ||||||
|     def get_post_impressions_over_time(self, post, *args, **kwargs): |     def get_post_impressions_over_time(self, post, *args, **kwargs): | ||||||
|         return self.s.get("{}/v1/post/{}/impressions/time".format(self.root_url, post), *args, **kwargs) |         return self.s.get("{}/v1/post/{}/impressions/time".format(self.root_url, post), *args, **kwargs) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -4,13 +4,15 @@ class PromoterCampaignManagementAPI: | |||||||
|         self.s = session |         self.s = session | ||||||
| 
 | 
 | ||||||
|     def approve_promoter_campaign(self, campaign, *args, **kwargs): |     def approve_promoter_campaign(self, campaign, *args, **kwargs): | ||||||
|         return self.s.post("{}/v3/promotionNetwork/promoter/campaign/{}".format(self.root_url, campaign), *args, **kwargs) |         return self.s.post("{}/v3/promotionNetwork/promoter/campaign/{}".format(self.root_url, campaign), *args, | ||||||
|  |                            **kwargs) | ||||||
| 
 | 
 | ||||||
|     def get_current_status_of_promotion(self, *args, **kwargs): |     def get_current_status_of_promotion(self, *args, **kwargs): | ||||||
|         return self.s.get("{}/v3/promotionNetwork/promoter".format(self.root_url), *args, **kwargs) |         return self.s.get("{}/v3/promotionNetwork/promoter".format(self.root_url), *args, **kwargs) | ||||||
| 
 | 
 | ||||||
|     def get_details_for_campaign(self, campaign, *args, **kwargs): |     def get_details_for_campaign(self, campaign, *args, **kwargs): | ||||||
|         return self.s.get("{}/v3/promotionNetwork/promoter/campaign/{}".format(self.root_url, campaign), *args, **kwargs) |         return self.s.get("{}/v3/promotionNetwork/promoter/campaign/{}".format(self.root_url, campaign), *args, | ||||||
|  |                           **kwargs) | ||||||
| 
 | 
 | ||||||
|     def get_list_of_campaigns(self, *args, **kwargs): |     def get_list_of_campaigns(self, *args, **kwargs): | ||||||
|         return self.s.get("{}/v3/promotionNetwork/promoter/campaigns".format(self.root_url), *args, **kwargs) |         return self.s.get("{}/v3/promotionNetwork/promoter/campaigns".format(self.root_url), *args, **kwargs) | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user